PDA

View Full Version : Helpful SCAR Tricks



Smartzkid
06-11-2008, 02:51 AM
ScriptTerminate:
A procedure that's automatically called when your script ends, even if the user clicks the Stop button.
program New;
var
aBuffer: integer;

procedure ScriptTerminate;
begin
if(aBuffer <> 0)then
FreeBitmap(aBuffer);
writeln('Resources Freed.');
//ProgressReport;
end;

begin
aBuffer := CreateBitmap(100, 100, '');
//DoStuff;
end.

Note that there are also ScriptPause and ScriptResume procedures that work the same way, these can also be useful in some situations.

Cases:
No longer will huge chains of If...Else haunt your scripts!
program New;
var
rand: integer;
begin
rand := random(10);
case rand of
0: //Walk to one place
1: //Walk to a second place
2: //Do antiban
3: //Idle for a few seconds
4: //Do antirandoms
5: //Find a bank
6, 7, 8: //Do nothing
9: //Give a jump for joy!
end;
end.


Well, I'd love to put more information in this tutorial, but I really can't come up with anything else. Feel free to drop me a PM if you know of a good addition to this tutorial, or if you need help with anything.

PS: Constructive criticism more than welcome!


Thanks to:
Wizzup - ScriptPause, ScriptResume

firefoxx
06-11-2008, 04:41 AM
Nice tutorial, thx

guidenation
06-11-2008, 10:54 PM
Thank you very much.

Wizzup?
06-11-2008, 11:33 PM
There is also ScriptPause and ScriptResume. :p
Also, add more tricks, I think this is a nice tutorial.

Smartzkid
06-12-2008, 03:57 AM
Thanks Wizz, added both.

Not really sure what I should put now.

Brainstorm:
advice for if-else chains
how to debug efficiently
tips for walking (various landmarks & other features that you can use)

Anything there sound good?

kor
06-12-2008, 05:53 AM
I'd like to read some about tips for walking (various landmarks & other features that you can use)