sleep(1) is more like waitfor(this, "none", 1) in GS2 the benefit of this it doesn't stop the execution of the script, that's my preferred method If its viable. scheduleevent can call a function on a timer basis. Basically It wont trigger the function immediately but when it hits the timer. Its better then timeout since it can be called once. Although I seen some people set there setTimer(0) (not sure if that even works, never tried it), which is ugly in my opinion. Reason I used this is because like your join classes, It's good to have one centralized place for repetitive code. instead of adding this.chat = "" after ever function its only in one place. Format just organized your code in a readability type way. Instead of doing things like,
PHP Code:
echo("test1:" SPC temp.test1 SPC "test2:"SPC temp.test2 SPC "test3:"SPC temp.test3)
which looks horrible you could do
PHP Code:
echo(format("test1: %s test2: %s test3: %s", temp.test1, temp.test2, temp.test3));
It also can be used to replace parts of a string. Without using replacetext which could be intensive in some instances.
PHP Code:
temp.copy_id = player.account;
temp.level = findlevel(format("mylevel-%s.nw", temp.copy_id));