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.
Entire forum
➜ MUSHclient
➜ Lua
➜ trying to change over my root counter from cmud to mush
trying to change over my root counter from cmud to mush
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Dragonlord
(24 posts) Bio
|
Date
| Fri 26 Feb 2016 10:05 PM (UTC) |
Message
| #class {Maleficarum Counter}
TotalRoots is a variable and %d is the total amount of roots I am carrying at my rootbags, and trunks.
The triggers are for after battles and scatters roots that gathered.
The #ST is my status bar display
At this moment I have 3 trunks and 2 rootbag, and the way I have to do the put roots into the containers are like so
put all.malef seven
put all.malef 2.seven
put all.malef trunk
put all.malef 2.trunk
put all.malef 3.trunk
in cmud I was able to
{i}.seven
{i}.trunk
#VAR TotalRoots %d
#TRIGGER {You take (%d) of a maleficarum root from the corpse} {#AD TotalRoots %d}
#TRIGGER {You take a maleficarum root from the corpse};#AD TotalRoots 1
#TRIGGER {A gnarled and blackened root is on the ground.};#AD TotalRoots 1
#ST {Roots gathered: @TotalRoots}
#Class 0
any help would be vary helper
thanks | Top |
|
Posted by
| Nick Gammon
Australia (23,094 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 27 Feb 2016 12:20 AM (UTC) |
Message
| To get you started, here is one of the triggers converted:
<triggers>
<trigger
enabled="y"
match="A gnarled and blackened root is on the ground."
send_to="12"
sequence="100"
>
<send>
SetVariable ("TotalRoots", (tonumber (GetVariable ("TotalRoots")) or 0) + 1)
SetStatus ("Roots gathered: ", GetVariable ("TotalRoots"))
</send>
</trigger>
</triggers>
|
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
GetVariable ("TotalRoots") gets you the variable contents. Since that is a string, to add to it you need to convert it to a number with tonumber.
The very first time, when the variable doesn't exist yet, you will get nil. Saying "or 0" substitutes zero in that case.
Then we add 1 to it, and put the result back into "TotalRoots". |
- 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.
9,033 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top