Sorry for all the silly questions, but I've checked the scriptfunction list and can't find a rand function, is there one and whats the syntax?
Random Number function.
Posted by Shigs on Mon 04 Feb 2008 04:42 PM — 6 posts, 30,944 views.
I've looked for "rand" in the help function and found:
math.random () --> 0.30195013275552 (for example)
math.random (5) --> (a number from 1 to 5)
math.random (4, 8) --> (a number from 4 to 8)
And as it's alua function from the "module" math, it's not in the list of script functions (I assume).
math.random () --> 0.30195013275552 (for example)
math.random (5) --> (a number from 1 to 5)
math.random (4, 8) --> (a number from 4 to 8)
And as it's alua function from the "module" math, it's not in the list of script functions (I assume).
Ok, it seems having the rand function dosen't help me at all,
What I actually wanted was a command to be inputted after a random number of seconds between 20-30 seconds, given the way timers work I can't do that or can I?
What I actually wanted was a command to be inputted after a random number of seconds between 20-30 seconds, given the way timers work I can't do that or can I?
By the way, there is a speed walk delay in the World Configuration->Input->Commands. but this is giving you a fixed delay.
But back to your question: it's possible, if I understand you correctly. How do you fire this? on an trigger you will send a fixed command with a random delay? Or you will put in "xx command" and after 20-30 seconds the command is send to the mud?
But back to your question: it's possible, if I understand you correctly. How do you fire this? on an trigger you will send a fixed command with a random delay? Or you will put in "xx command" and after 20-30 seconds the command is send to the mud?
I was initaly thinking of setting a timer for 15 seconds and then having a delay of between 4-14 seconds to launch the command
As well as the MUSHclient functions you are advised to check the help for Lua functions, eg.
http://www.gammon.com.au/scripts/doc.php?general=lua_math
These are language-specific functions (or in some cases extensions I added for Lua) that do stuff like random numbers, sine, cosine, string formatting, and so on.
What is wrong with:
That generates a number between 20 and 30, randomly.
Thus you could do:
http://www.gammon.com.au/scripts/doc.php?general=lua_math
These are language-specific functions (or in some cases extensions I added for Lua) that do stuff like random numbers, sine, cosine, string formatting, and so on.
Quote:
What I actually wanted was a command to be inputted after a random number of seconds between 20-30 seconds, given the way timers work I can't do that or can I?
What I actually wanted was a command to be inputted after a random number of seconds between 20-30 seconds, given the way timers work I can't do that or can I?
What is wrong with:
math.random (20, 30)
That generates a number between 20 and 30, randomly.
Thus you could do:
DoAfter (math.random (20, 30), "sigh")