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
➜ Trying to simply life a bit, not geting anywhere
|
Trying to simply life a bit, not geting anywhere
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jodans
(4 posts) Bio
|
| Date
| Thu 24 Jul 2008 11:47 PM (UTC) |
| Message
| Ok so I'm trying to clean up my triggers a bit, but have no idea how to script what I am needing (if even possible).
The whole purpose of the triggers/script is to change the variables for a trigger that fires to two messages.
The first trigger fires and sends "research @variable"
I would like the second trigger to change @variable, every time it fires.
The end result is hopefully a 'queue' of variables to be loaded as the new variable fires off.
Here are the triggers I have right now, they might help get a good idea of what I mean:
<triggers>
<trigger
expand_variables="y"
group="eng"
match="You can't learn any more about that from books!"
name="a"
send_to="12"
sequence="100"
>
<send>EnableTrigger("b", true)
SetVariable("study", "@a")
SendImmediate("research @a")
EnableTrigger("a", false)</send>
</trigger>
</triggers>
<triggers>
<trigger
expand_variables="y"
group="eng"
match="You can't learn any more about that from books!"
name="b"
send_to="12"
sequence="100"
>
<send>EnableTrigger("c", true)
SetVariable("study", "@b")
SendImmediate("research @b")
EnableTrigger("b", false)</send>
</trigger>
</triggers>
<triggers>
<trigger
expand_variables="y"
group="eng"
match="You can't learn any more about that from books!"
name="c"
send_to="12"
sequence="100"
>
<send>EnableTrigger("d", true)
SetVariable("study", "@c")
SendImmediate("research @c")
EnableTrigger("c", false)</send>
</trigger>
</triggers>
And so on from here.
I would rather be able to just make a list of things for the variable to switch to when that match fires, rather than having to create 20 different triggers to enable/disable eachother.
There are multiple uses I have planned for this, so I am hoping someone can help me get this scripted. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 25 Jul 2008 09:20 AM (UTC) |
| Message
| You are right to want to do that in a less complicated way. :)
Tables are your friends, using them you can simply step through a sequence of things. I made a single trigger that would handle any number of things you want to research:
<triggers>
<trigger
custom_colour="2"
enabled="y"
group="eng"
match="You can't learn any more about that from books!"
send_to="12"
sequence="100"
>
<send>
-- things we need to research
booklist = booklist or {
"wine",
"women",
"song",
}
require "var"
-- move onto next one
var.bookitem = (var.bookitem or 0) + 1
-- end of list? all done! phew!
if tonumber (var.bookitem) > #booklist then
Note ("Done learning!")
return
end -- if
-- research it
Send ("research " .. booklist [tonumber (var.bookitem)])
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Jodans
(4 posts) Bio
|
| Date
| Reply #2 on Fri 25 Jul 2008 10:07 AM (UTC) Amended on Fri 25 Jul 2008 10:17 AM (UTC) by Jodans
|
| Message
| Thank you very much, this is going to help a lot.
I thought it may be a table of some sort, but didn't know.
I can make the triggers pretty well, but when it comes to an actual script, I'm lost, though once I have what I need in front of me I can make changes to suit my needs.
I.E. this is going to be put in twice, for two different functions.
So for that variable to be used in a trigger is it @booklist we would be expanding?
Error number: 0
Event: Compile error
Description: [string "Script file"]:1: unexpected symbol near '<'
Called by: Immediate execution
I put the script into a notepad and renamed it to whatever.lua and when I close the script window after selecting that file as my script file that error pops up. I'm trying to find where it may be from, but not sure I'll be able to. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Fri 25 Jul 2008 10:43 AM (UTC) |
| Message
| |
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.
15,596 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top