| Blockland Forums > Modification Help |
| Delay Won't Work |
| (1/1) |
| phflack:
something makes the delay screw up, i'm trying to have it so that if you used the keybind in the last 5 seconds, it displays the next function, but if it hasn't been used in the last 5 seconds, to just display the function it's currently on i should probably change the top comment too... --- Code: ---//Hug toggle, keybind code ripped from Ephialtes' quicksave, and commandtoserver('unusetool'); was suggested by Ephialtes //Stolen from Ephialtes who stole from Randy function AddBind(%division, %name, %command) { for(%i=0;%i<$remapCount;%i++) { if($remapDivision[%i] $= %division) { %foundDiv = 1; continue; } if(%foundDiv && $remapDivision[%i] !$= "") { %position = %i; break; } } if(!%foundDiv) { error("Division not found: " @ %division); return; } if(!%position) { $remapName[$remapCount] = %name; $remapCmd[$remapCount] = %command; $remapCount++; return; } for(%i=$remapCount;%i>%position;%i--) { $remapDivision[%i] = $remapDivision[%i - 1]; $remapName[%i] = $remapName[%i - 1]; $remapCmd[%i] = $remapCmd[%i - 1]; } $remapDivision[%position] = ""; $remapName[%position] = %name; $remapCmd[%position] = %command; $remapCount++; } if(!$AutoBound) { AddBind("Action", "Toggle", "AutoToggle"); AddBind("Action", "On", "AutoOn"); $AutoBound = true; } $AutoLast = 0; function AutoToggle(%i) { if(%i) return; if($LastAuto == 0) { $LastAuto = 1; $AutoLast = schedule(5000, 0, autolast); } else { if($Auto >= 9) $Auto = 1; else $Auto++; $LastAuto = 1; $AutoLast = schedule(5000, 0, autolast); cancel($AutoLast); } switch($Auto) { case 1: NewChatSO.addLine("<color:ffffff>mousefire(1);"); case 2: NewChatSO.addLine("<color:ffffff>jet(1);"); case 3: NewChatSO.addLine("<color:ffffff>jump(1);"); case 4: NewChatSO.addLine("<color:ffffff>crouch(1);"); case 5: NewChatSO.addLine("<color:ffffff>autoclicker();"); case 6: NewChatSO.addLine("<color:ffffff>moveforward(1);"); case 7: NewChatSO.addLine("<color:ffffff>moveback(1);"); case 8: NewChatSO.addLine("<color:ffffff>moveright(1);"); case 9: NewChatSO.addLine("<color:ffffff>moveleft(1);"); } } function AutoOn(%i) { if(%i) return; switch($Auto) { case 0: mousefire(1); case 1: mousefire(1); case 2: jet(1); case 3: jump(1); case 4: crouch(1); case 5: autoclicker(); case 6: moveforward(1); case 7: moveback(1); case 8: moveright(1); case 9: moveleft(1); } } function autolast() { $quack = 0; } function autoclicker() { mousefire(1); schedule(33, 0, mousefire, 0); $autoclicker = schedule(66, 0, autoclicker, true); } --- End code --- |
| howtoshotbillwetellyou:
--- Code: ---function autolast() { $quack = 0; } --- End code --- but where in the script is $quack used? also, be sure to experiment with isEventPending($autoLast); |
| phflack:
--- Quote from: howtoshotbillwetellyou on January 23, 2011, 12:38:00 AM --- --- Code: ---function autolast() { $quack = 0; } --- End code --- but where in the script is $quack used? also, be sure to experiment with isEventPending($autoLast); --- End quote --- oh, oops, that's what i was using while testing stuff, didn't mean to write that there :D no wonder it didn't work... edit: changed that to the right variable name, still isn't working :c |
| howtoshotbillwetellyou:
--- Quote from: phflack on January 23, 2011, 01:02:51 AM ---oh, oops, that's what i was using while testing stuff, didn't mean to write that there :D no wonder it didn't work... edit: changed that to the right variable name, still isn't working :c --- End quote --- can you update your original post, and remove the crap that doesnt cause the error, like that whole first function, i believe edit: also --- Code: --- $AutoLast = schedule(5000, 0, autolast); cancel($AutoLast); --- End code --- so, you call the schedule, and then you cancel it right after, why? if anything, it should be cancel(this); schedule(this); |
| phflack:
hehe, wasn't really thinking, ment to put the cancel BEFORE the schedule, that way it would clear the last one... |
| Navigation |
| Message Index |