Register forum user name Search FAQ

Gammon Forum

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 ➜ Trigger Help (*Newbie warning :P)

Trigger Help (*Newbie warning :P)

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


Posted by Trunks_Zero   (13 posts)  Bio
Date Thu 17 Apr 2003 10:47 PM (UTC)

Amended on Thu 17 Apr 2003 11:29 PM (UTC) by Nick Gammon

Message
K, this place helped out alot when I had problems before, so I'll just try again.

A MUD I play has a kingdom system, so you can purchase farms/mines/land for your people to live on, and you get gold off it.

Now, my question is, how could I set it up so when I get
50 000 gold in my treasury or more, how could I set it to do a list of commands to upgrade my kingdom. Here's a sample of what the kingdom screen looks like.


##########################################################
# Vassals: 2890     Possible gain one vassal: 2  hours.  #
# Morale: Fair                                           #
# Tax Percent: 35          Avg Gold Earned: 4254      gp #
#--------------------------------------------------------#
# Farms: 244   Food Consumed: 2890  Food Produced: 4880  #
# Mines: 488   Res Consumed:  289    Res Produced: 488   #
# Parcels: 732       Max Land Area:  7320                #
# Research: 0        Research Level: 0                   #
#--------------------------------------------------------#
# Hourly Operating Costs:  2440                       gp #
# Hourly Change in Income: 1814                       gp #
# Your Current Treasury:   50000                      gp #
##########################################################


Now, that'll prolly look pretty screwed up in the forums, just copy/paste it into notepad, and it should look right.

Your Current Trasury: -- is the part where it shows your current gold reserves, so I'm just wondering how you could set it to that when you get a certain amount of cash, it'll set off the trigger.

Edited by Nick to add [code] and [/code].
Top

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #1 on Thu 17 Apr 2003 10:49 PM (UTC)
Message
Ok, that didn't look right.

Uhm, the Your current treasury is right, so I spose when you do the trigger, you could just put in some variables to make up for the spaces, and then the #, but if you can't, or it's too troublesome, the # is supposed to line up with the last # on the bottom line.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #2 on Thu 17 Apr 2003 11:05 PM (UTC)
Message
type [code] at the beginning of the snippet, and [/code] at the end, and then down at the bottom of the window, Check the "enable forum codes". That will help you with the spacing.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 17 Apr 2003 11:32 PM (UTC)
Message
Your trigger could probably be a regular expression something like this:


^# Your Current Treasury: ([0-9]+)[ ]+gp #$


The [0-9]+ will match one or more digits, and [ ]+ will match one or more spaces. The round brackets make the number be returned as a wildcard.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #4 on Thu 17 Apr 2003 11:36 PM (UTC)
Message
Huh?

What I need is a restricted variable. One that would only fire when the treasury value is 50000+.

Would that trigger still work?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 17 Apr 2003 11:39 PM (UTC)
Message
No, that is just how to find that line. Triggers can't really be conditional like that. However in the latest versions of MUSHclient you can "send to script", so put the condition in the trigger text.

eg. Set the "send to" to "script" and in the "send to" box put something like this:


if %1 > 50000 then
   world.send "show command blah"
end if

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 17 Apr 2003 11:41 PM (UTC)
Message
In the Scripting configuration tab make sure scripting is enabled, language VBscript, although you don't need a script file if this is all the scripting you are doing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #7 on Thu 17 Apr 2003 11:45 PM (UTC)
Message
You'd have to do some scripting, have it fire a script, which checks if its over the ammount you want, and then if so, does whatever you want it to do...

I dont THINK you can put that in the send box... But, some of the stuff Nick put in the chat plugin, makes me question the truth of that statement.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Trunks_Zero   (13 posts)  Bio
Date Reply #8 on Thu 17 Apr 2003 11:46 PM (UTC)
Message
I have version 3.32, and I don't see 'send to script' in the trigger window.

The MUD I play doesn't require alot of scripts/complicated triggers, so normally I just stick to normal variables, so sorry to seem to newbish.

Anyways, I already have one script enabled, in VBS language... I assume I can have more than one enabled, or what?

Top

Posted by Dave   Australia  (93 posts)  Bio
Date Reply #9 on Fri 18 Apr 2003 03:59 AM (UTC)
Message
Can't really be conditional Nick?!
^# Your Current Treasury: (\d{6,}|[5-9]\d{4})[ ]+gp #$
In laymans terms.. match 6 digits or more, or match 5 digits where the first digit is 5 to 9.. in other words, 50000 and above. Aren't regular expressions FUN?!
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #10 on Sun 20 Apr 2003 02:49 AM (UTC)
Message
I did put the qualifier "really" there just in case someone could come up with something like that, however this would fail your method:

000001

That is 6 digits, but is not over 50000. Of course, the MUD may not send leading zeroes, and you might be certain of that.

The "send to script" technique is in recent versions of MUSHclient, not yet announced on the downloads page, however if you see the forum section "MUSHclient -> News" you will see the latest ones. I suggest downloading 3.38 which is the latest and probably the most stable of the recent releases.

- 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.


26,559 views.

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

Go to topic:           Search the forum


[Go to top] top

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