usr.maxpowerlevel += rand(1,5000)
usr << "Your Powerlevel Went Up Loads!"
sleep (100)
is there a way so this reapeats without me re writting the code 100000000 times ?
ID:269741
Sep 28 2005, 10:03 am
|
|
usr.maxpowerlevel += rand(1,5000) is there a way so this reapeats without me re writting the code 100000000 times ? |
Your best bet is a while() or for() statement.
Here's a simple example of how you'd do a while(). mob Or you can use a variable so it doesn't loop forever: mob for() loops aren't really required in place of while() in most cases, but in the case of the second example a for() would be better since you can include the variable addition/subtraction without having to change the contents of the loop. |
In response to Lummox JR
|
|
sorry 2 send needy but plz can u write the code ot for me i tried the for()& while()but i was getting
invalid expression thanks |
In response to Nadrew
|
|
ahhh thanks again Nadrew
|
In response to JRR-Zero
|
|
ahhhhh nadrew lol i used ur code and now im more confused before lol
on my first code usr.maxpowerlevel += rand(1,5000) |
In response to JRR-Zero
|
|
JRR-Zero wrote:
ahhhhh nadrew lol i used ur code and now im more confused before lol usr.maxpowerlevel += rand(1,5000) while(1) And Nadrew, for your repeat_num var, it should have been as null|numso they could cancel out. :P |
In response to Sinoflife
|
|
i done that code just now tried it and when i done it my dream seeker froze and shut down : and maby i missed a bit out that might have been important :
verb/Wear() plz help lol |
In response to JRR-Zero
|
|
verb/Wear() You really need to learn how to indent properly. |
In response to Sinoflife
|
|
its still freezing
|
In response to JRR-Zero
|
|
JRR-Zero wrote:
its still freezing When you run into problems like this, it's best to post the code as it currently stands so we don't have to guess at which parts you changed. Based on your posts in this thread and others, I think it's likely bordering on certain that you didn't indent the code correctly, so that the sleep() proc is appearing outside of the while() loop. You seem to be mixing tabs and spaces in your indentation a lot. I strongly recommend you hit Ctrl+T in Dream Seeker to show tab and space characters. Lummox JR |
In response to Sinoflife
|
|
Sinoflife wrote:
And Nadrew, for your repeat_num var, it should have been as null|numso they could cancel out. :P It wasn't optional, so I excluded the cancel button on purpose. |
In response to Nadrew
|
|
Makes no sense to have it nonoptional, I hate to be stuck on input boxes, unwanting to enter anything.
|
In response to Sinoflife
|
|
Sinoflife wrote:
Makes no sense to have it nonoptional, I hate to be stuck on input boxes, unwanting to enter anything. Agreed. In most cases it's best to include a cancel choice. Lummox JR |
Yes. Use a simple loop like while() or for().
Lummox JR