Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Random Vscript Triggers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Shorembro
(1 post) Bio
|
Date
| Mon 08 Jan 2007 04:07 PM (UTC) Amended on Mon 08 Jan 2007 05:59 PM (UTC) by Shorembro
|
Message
| Hi, I'm new to this.
I'm just trying to make a trigger so that when I get the message:
Move!
I move my character in a random direction. (north, east, south, west)
Thank you so much,
Jennifer
EDIT - uh just trying out Lua, how might I randomize this in Lua per say? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 08 Jan 2007 07:56 PM (UTC) |
Message
| This trigger will do that:
<triggers>
<trigger
enabled="y"
match="Move!"
send_to="12"
sequence="100"
>
<send>
local directions = { "n", "s", "e", "w" }
Send ( directions [ math.random (#directions) ] )
</send>
</trigger>
</triggers>
If you wanted more directions (eg. up, down, ne, nw etc.) then add them to the list.
What this does is use math.random to randomly pick an item from the "directions" table, in the range 1 to the number of entries (4 in the example above). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
8,544 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top