Trigger Help (*Newbie warning :P)

Posted by Trunks_Zero on Thu 17 Apr 2003 10:47 PM — 11 posts, 35,837 views.

#0
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].
Amended on Thu 17 Apr 2003 11:29 PM by Nick Gammon
#1
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.
USA #2
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.
Australia Forum Administrator #3
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.
#4
Huh?

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

Would that trigger still work?
Australia Forum Administrator #5
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
Australia Forum Administrator #6
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.
USA #7
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.
#8
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?

Australia #9
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?!
Australia Forum Administrator #10
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.