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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  trying to change over my root counter from cmud to mush
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

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] Refresh page


Posted by Dragonlord   (24 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] 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>



Template:pasting 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
[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.


1,588 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]