[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]  General
. . -> [Subject]  Trigger problem
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Trigger problem

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


Posted by Stormy   (1 post)  [Biography] bio
Date Fri 30 Apr 2004 08:50 AM (UTC)
Message
Hi there,

Got a bit of a problem. I'm trying to make a trigger to show experience gain/loss in RetroMUD. the status bar ingame, which shows after each time you enter a command or simply hit enter, shows in the format:

Hp: 584/584 Sp: 1223/1223 Ep: 280/280 Gold: 212 Exp: 1166950 >

/world.debug "triggers" shows:

{{Hp: * Sp: * Ep: * Gold: * Exp: * >}}={{%5}} label=iworldexp script=expgained colour=1 send_to:variable seq:100

and the expgained script is:

sub expgained (thename, theoutput, thewildcards)

dim iNewexp
dim iOldexp
dim iDiff

iOldExp=world.GetVariable("ioldexp")
iNewExp=world.GetVariable("iworldexp")

if iNewexp > iOldexp then
iDiff=iNewexp-iOldexp
world.note "Exp gained : " & cstr (iDiff)
end if
if iNewexp < iOldexp then
iDiff=iOldexp-iNewexp
world.note "Exp lost : " & cstr (iDiff)
end if

if iNewexp=iOldexp then
world.note "No exp change"
end if
World.SetVariable "ioldexp", iNewexp
end sub

/world.debug "variables" :

iworldexp = 1166950
ioldexp = 1166950

Can anyone see what I'm missing? It just doesn't want to work :(

Thanks!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Fri 30 Apr 2004 09:35 AM (UTC)

Amended on Sat 01 May 2004 06:38 PM (UTC) by Flannel

Message
Why are you sending to variable? You can just get it from the wildcards.

Anyway, you might be better off declaring outside of your sub, and then not storing the oldxp in an MC variable, just use a VBscript. Itll stay as long as you dont need to reset your script. And even then, itll only last for one promt, then itll get re-written. Itll save you a lot of time for your script, and since this happens a lot, it might make a difference.

<wrong>
For your if statement, you need to have a double equals sign (==) (since its logical). </wrong> (No, Its not, I was just being weird and staying in C (actually, I think it was TIBasic), pay no attention to the man behind the curtain)

This is assuming your trigger matches. Theres plenty of problems associated with matching a prompt, search the forums for a bunch of threads on it. You might be fine if you simply add a spot for other stuff at the end of your prompt (see other threads for more details). This MIGHT require you to convert your trigger to a regexp.

To see if your trigger is matching all the time, you can turn trace on. This way you can see if your problem is in the trigger, or the script, for any given time.

Also, for future reference, copy/paste your trigger/alias/whatever rather than doing the debug thing.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #2 on Sat 01 May 2004 12:41 PM (UTC)
Message
Actually, VBScript doesn't use the == operator, = is right. And yes, it would be better if instead of sending to a variable you used a scripting variable. If you need to save the script with its variables, you could try SetVariable to do it from within the script.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[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.


2,911 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]