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 ➜ Tips and tricks ➜ Problem with a trigger

Problem with a trigger

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


Posted by Cyrgon   (6 posts)  Bio
Date Wed 13 Jun 2007 10:02 PM (UTC)
Message
Alright, I've been trying this for a day or two now and I just can't get it right.

What I'm trying to do is this:
I want a trigger to react to a part of a line which is:

As a reward, I am giving you 51 quest points

However, I also want it to extract the numerical value, in this case 51.
Essentially react to:
As a reward, I am giving you x quest points

And then be able to use the x value for a command.
Like simply "say x"

Is it impossible or am I just a little too daft? ;)

Help would be much appreciated.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 13 Jun 2007 10:05 PM (UTC)
Message
See http://mushclient.com/faq point 31.

- Nick Gammon

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

Posted by Cyrgon   (6 posts)  Bio
Date Reply #2 on Thu 14 Jun 2007 02:00 AM (UTC)
Message
Thanks! That helped a bit.

However, I can't quite get it to work at all.

This is how I configured my trigger:

<triggers>
<trigger
enabled="y"
match="As a reward, I am giving you * quest points"
send_to="12"
sequence="100"
>
<send>
qt = tonumber (GetVariable ("qt")) or 0
qt = qt + %1
SetVariable ("qt", qt)
</send>
</trigger>
</triggers>

And the only result is a scripting error occuring claiming "can't use parenthesis when calling a Sub" at SetVariable ("qt", qt)

I can't quite figure out what I'm doing wrong, since I'm quite new to this stuff.

Once again, help would be much appreciated :)


Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Thu 14 Jun 2007 02:04 AM (UTC)
Message
It looks like you're writing Lua code, but the error message you're getting looks like VBScript. Try making sure you have the right script engine enabled for your triggers.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Cyrgon   (6 posts)  Bio
Date Reply #4 on Thu 14 Jun 2007 02:14 AM (UTC)
Message
You are correct. I just realized that ;)
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.


19,443 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.