[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Trying to simply life a bit, not geting anywhere

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Trying to simply life a bit, not geting anywhere
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Fri 25 Jul 2008 10:43 AM (UTC)  quote  ]
Message
Read this: http://mushclient.com/pasting

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Jodans   (4 posts)  [Biography] bio
Date Fri 25 Jul 2008 10:07 AM (UTC)  quote  ]

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.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Fri 25 Jul 2008 09:20 AM (UTC)  quote  ]
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) &gt; #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
[Go to top] top

Posted by Jodans   (4 posts)  [Biography] bio
Date Thu 24 Jul 2008 11:47 PM (UTC)  quote  ]
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.
[Go to top] 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.


885 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]