| Blockland Forums > Modification Help |
| how would i slow a for statement? |
| << < (4/5) > >> |
| phflack:
fixed the countdown, lemme look at the bottles of spam new code of it: --- Code: ---function eat(%i) { commandtoserver('consume',"purifiedwater"); commandtoserver('consume',"banana"); if(%i != "stop") { $eatsched=schedule(10000,0,eat); } else { cancel($eatsched); } } function countdown(%a, %b) { if(%b >= 0 && %a >= 1) { commandtoserver('messagesent', %b); %b--; schedule(%a, 0, countdown, %a, %b); } } function bottlesofspam(%a, %b, %c) { if(%b > 0) { if(%c >= 3) { %c = 1; %b--; } else { %c++; } switch(%c) { case 1: commandtoserver('messagesent', %b @ " bottles of spam on the wall."); break; case 2: commandtoserver('messagesent', %b @ " bottles of spam!); break; case 3: commandtoserver('messagesent', "Take one down, unleash the spam..."); break; } if(%a > 0) { schedule(%a, 0, bottlesofspam, %a, %b, %c); } } else { commandtoserver('messagesent', "Looks like we ran out of bottles of spam!"); } } --- End code --- edit: i don't think %b would work there, because i already have a check if %b is at 1 or so i think, and i wanted it so if i did bottlesofspam(0); then it would stop edit again: updated script edit: another problem is that i have to use exec("add-ons/client_commands/client.cs"); before i can use it, after opening BL |
| Syntax:
--- Quote from: phflack on August 31, 2010, 07:01:30 PM --- --- Code: ---function bottlesofspam(%a, %b, %c) { if(%b > 0) { if(%c >= 3) { %c = 1; %b--; } else { %c++; } switch(%c) { case 1: commandtoserver('messagesent', %b @ " bottles of spam on the wall."); break; case 2: commandtoserver('messagesent', %b @ " bottles of spam!); break; case 3: commandtoserver('messagesent', "Take one down, unleash the spam..."); break; } if(%a > 0) { schedule(%a, 0, bottlesofspam, %a, %b, %c); } } else { commandtoserver('messagesent', "Looks like we ran out of bottles of spam!"); } } --- End code --- --- End quote --- This looks annoying, why are you making such a useless script? |
| Pew446:
Why doesn't C# have a wait(); function like Lua? It is extremely useful. |
| Headcrab Zombie:
This isn't even C# |
| Pew446:
Torquescript is really similar, though. So when I look for tutorials on how to do something in TorqueScript, I look it up in C# first. |
| Navigation |
| Message Index |
| Next page |
| Previous page |