[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]  MUSHclient Help
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

MUSHclient Help

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


Pages: 1 2  

Posted by Artel   USA  (65 posts)  [Biography] bio
Date Wed 30 Jun 2004 11:27 PM (UTC)
Message
Hello..

I'm a rather new user of MUSHclient(love it:) and MUD clients in general. I apologize if someone else has already covered my topic, but I really don't know what to do here. What I want to do is send quest reward info to the group channel(gtell). I currently have something quite simple like this:
(Message I receive from the mud):
Questor tells you 'As a reward, I am giving you 12 quest points and 174 gold.'
You get lucky and gain an extra 2 quest points.
You gain an extra 2 quest points 'MCCP Bonus'.

Trigger:
Questor tells you 'As a reward, I am giving you * quest points and * gp.'
Send:
gtell Quest completed: %1 qp, %2 gp.

But I really received 12 +2 +2 (16 total) quest points. I want the message to the MUD to say 16 not the 12.

I assume that I would use a variable here, but I don't know how to increase the variable by however many bonus points recieved.

Any help would be greatly appreciated.
Thanks
-Rathik

Artel.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Thu 01 Jul 2004 01:58 AM (UTC)
Message
I'm assuming that the easier solution of just sending multiple group tells is not acceptable? :-) To do it in one go is a bit harder, since you don't always get the bonuses and all; it's not impossible, but requires considerably more effort than just sending multiple tells.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 01 Jul 2004 04:40 AM (UTC)
Message
Your problem here is I assume you don't always "get lucky" and get the extra bonus. Thus, sending on a trigger of the first line may or may not be too soon, and waiting for the "get lucky" line may be wrong if it doesn't arrive.

What might work is to set up some multiple-line triggers, where you need to know something that happens *after* those three lines (like a prompt line).

Thus you might match on (roughly):

Questor tells you 'As a reward, I am giving you (.*) quest points and (.*) gp\.'\nYou get lucky and gain an extra (.*) quest points\.\nYou gain an extra (.*) quest points 'MCCP Bonus'\.\n<.*>.*\z

This is just the general idea, I haven't tested it. This would match all 3 lines if you got them, terminated by the prompt line ( < 10 hp 20 m 30 mv > blah ) or whatever.

Then make another one with only two lines, and then the one line. Hopefully one of them and only one will match a particular situation.

Then your trigger "send" box can do a bit of arithmetic to add up the points.



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 01 Jul 2004 04:44 AM (UTC)
Message
Or, you can probably make a single multi-line trigger with the extra lines as options. Read up on regular expressions, but basically you can do something like this:

Match: blah blah (this is optional)?

The "?" after a group means match zero or one of the group, so it would match "blah blah" followed by an optional occurrence of "this is optional".

So (again without testing) it might look like this:

Questor tells you 'As a reward, I am giving you (.*) quest points and (.*) gp\.'\n(You get lucky and gain an extra (.*) quest points\.\n)?(You gain an extra (.*) quest points 'MCCP Bonus'\.\n)?<.*>.*\z

Notice the extra brackets with the question marks. You can express the same idea a bit more readably with braces:

Questor tells you 'As a reward, I am giving you (.*) quest points and (.*) gp\.'\n(You get lucky and gain an extra (.*) quest points\.\n){0,1}(You gain an extra (.*) quest points 'MCCP Bonus'\.\n){0,1}<.*>.*\z




- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Artel   USA  (65 posts)  [Biography] bio
Date Reply #4 on Thu 01 Jul 2004 04:48 AM (UTC)
Message
Ksilyan, I have tried the multi-line solution already, and when I review the channel history at the end, it is a bit spammy. When combined with multi-lines of leveling messages and rewards, it is not pretty. :)

I should have mentioned this the in the first post, but since MUSHclient supports MCCP, it is guaranteed that I will get "You gain an extra 2 quest points 'MCCP Bonus'." every single time, and that message is always at the very end of the quest rewards. I just wanted to make sure those 2 were added to the total qp.

I will try what you mentioned, Nick, also.
Thanks again

Artel.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Thu 01 Jul 2004 06:01 AM (UTC)
Message
Yeah, the MCCCP can terminate it.

Have three triggers, for each of the lines. The first one catches it and turns the other two on (enabletrigger "triggerX", 1). Sends the number to the variable (which resets it), then the second one adds to it (Setvariable "questpoints", Cint(getvariable("questpoints"))+%1 then the third does the same, except it also sends it (and turns off itself (enabletrigger "triggerX", 0) and the second line one).
If the second one doesnt catch (because its not there) its no big deal, you dont need it.

And no, Ive never been a big fan of multiline triggers. What happens if things lag and a command gets put in between, or another line, or who knows what. This will always work, assuming you always get the MCCP bonus (which you will know if you do or dont).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Artel   USA  (65 posts)  [Biography] bio
Date Reply #6 on Thu 01 Jul 2004 08:20 PM (UTC)
Message
I'm afraid I might be a little more new than either one of us thought.. It makes sense to me what you said Flannel, but where do I put that stuff in at?

Artel.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Thu 01 Jul 2004 09:47 PM (UTC)
Message

^Questor tells you \'As a reward, I am giving you (\d{1,}) quest points and (\d{1,}) gold\.\'$
Triggername: QuestTrig1
Send to: script
Enabled, Regexp, Keep Evaluating
send: setvariable "goldgain", %2
setvariable "qpgain", %1
enabletrigger "QuestTrig2", 1
enabletrigger "QuestTrig3", 1

^You get lucky and gain an extra (\d{1,}) quest points\.$
Triggername: "QuestTrig2"
Send to: script
Regexp, Keep Evalutating, NOT ENABLED
send: setvariable "qpgain", Cint(getvariable("qpgain")+%1

^You gain an extra (\d{1,}) quest points \'MCCP Bonus\'\.$
Triggername: "QuestTrig3"
Send to: script
Regexp, Keep Evalutating, NOT ENABLED
send: setvariable "qpgain", Cint(getvariable("qpgain")+%1
enabletrigger "QuestTrig2", 0
enabletrigger "QuestTrig3", 0
send "Quest Complete: " & getvariable("qpgain") & " qp and " & getvariable("goldgain") & " gp."

That should do it, if I got all that right.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #8 on Fri 02 Jul 2004 12:20 AM (UTC)
Message
Glad that you have a good solution that does what you need. I didn't realize the MCCP line always came. I'm curious though; are they giving out a bonus for MCCP to encourage people to use it?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #9 on Fri 02 Jul 2004 01:20 AM (UTC)
Message
Thats what Id suspect. Less bandwidth usage, which means theoretically less lag, or whatever.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Artel   USA  (65 posts)  [Biography] bio
Date Reply #10 on Fri 16 Jul 2004 08:05 PM (UTC)
Message
Sorry for the late post.. but I have done what Flannel said, and nothing happens when I finish a quest. The qpgain and goldgain variables don't even change. What am I missing?

Artel.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #11 on Fri 16 Jul 2004 09:50 PM (UTC)
Message
Are you sure the triggers are matching? Try making the triggers change the color of the line, to see if it matches.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #12 on Fri 16 Jul 2004 09:55 PM (UTC)

Amended on Sat 17 Jul 2004 07:11 AM (UTC) by Flannel

Message
I got an email from someone asking if I could email them a copy/pastable version of this... I dont know which of the two of you it is. But, here it is (complete with color change to validate your regexp).

Copy between <triggers> and </triggers> then click "paste" in the trigger dialog.

<triggers>
  <trigger
   custom_colour="12"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^Questor tells you \'As a reward, I am giving you (\d{1,}) quest points and (\d{1,}) gold\.\'$"
   name="QuestTrig1"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>setvariable &quot;goldgain&quot;, %2
setvariable &quot;qpgain&quot;, %1
enabletrigger &quot;QuestTrig2&quot;, 1
enabletrigger &quot;QuestTrig3&quot;, 1
</send>
  </trigger>
  <trigger
   custom_colour="12"
   ignore_case="y"
   keep_evaluating="y"
   match="^You gain an extra (\d{1,}) quest points \'MCCP Bonus\'\.$"
   name="QuestTrig3"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>setvariable &quot;qpgain&quot;, Cint(getvariable(&quot;qpgain&quot;)+%1)
enabletrigger &quot;QuestTrig2&quot;, 0
enabletrigger &quot;QuestTrig3&quot;, 0
send &quot;Quest Complete: &quot; &amp; getvariable(&quot;qpgain&quot;) &amp; &quot; qp and &quot; &amp; getvariable(&quot;goldgain&quot;) &amp; &quot; gp.&quot;
</send>
  </trigger>
  <trigger
   custom_colour="12"
   ignore_case="y"
   keep_evaluating="y"
   match="^You get lucky and gain an extra (\d{1,}) quest points\.$"
   name="QuestTrig2"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>setvariable &quot;qpgain&quot;, Cint(getvariable(&quot;qpgain&quot;)+%1)
</send>
  </trigger>
</triggers>

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Skewer   (1 post)  [Biography] bio
Date Reply #13 on Mon 14 Mar 2005 12:10 AM (UTC)
Message
Hello

I just started using mushclient (aardwolf player)
but can't figure out how to enter this script - or even where to enter it! I know I may appear to be dumb but I've tried everything to get this to work.

I simply don't know how or where to enter it...I assumed in the trigger dialog in the config box.

hope someone can help me..
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #14 on Mon 14 Mar 2005 05:36 AM (UTC)
Message
Copy the whole thing (copy from <triggers> to </triggers> including that text) and then go to the triggers page (thats the one with all the lines where you can add triggers and such) and click 'paste' and that's it!
This button (except the triggers page not the alias one):
http://www.gammon.com.au/images/alias_paste.gif

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


19,266 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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]