SetTimer<#>(<#>);
Examples: SetTimer1(0.05); SetTimer2(1); SetTimer3(this.timer); etc.
then either something like this: PHP Code:
or something like this: PHP Code:
unless someone knows a better way to do this already, i've often found myself splitting up weapons into multiple weapons because i couldnt redefine onTimeout in one if(){;} and have another in an elseif(){;} (example, having my jump script change itself to a gravity script if the level is a sidescrolling level. but i couldnt do that so now i have a jump script that disables itself if its a sidescrolling level and a gravity script that activates if its a sidescrolling level. which seems like more than i needed to have.) then, whenever i need multiple timers and cant split up the script, i also find myself doing something crude like this: PHP Code:
|
First of all, nothing should go outside of function definitions (brackets).
There is also scheduleevent(time, eventname, params...). So if you do scheduleevent(1, "Pancake", null), then function onPancake() will be called in one second. I imagine this is not quite as efficient as a timeout, so use the timeout for stuff that is 0.05. Edit: Also your script should have been looping at 0.5 since that is the smallest timer rather than 0.05. |
If you wanna do what you were asking for:
scheduleevent(timer, "Timeout1", null); |
Quote:
PHP Code:
|
Quote:
PHP Code:
|
Woah. a lot of interesting stuff here. thanks guys, I'll play around with them and see if i cant figure them out :D
|
All times are GMT +2. The time now is 11:53 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.