[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Prompting my current EXP to the infobar

Prompting my current EXP to the infobar

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


Pages: 1 2  

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Sun 15 May 2011 01:32 AM (UTC)
Message
Hi all.

I currently have a system that captures my stats from the prompt and displays it on the infobar.
I would very much like to add my current experience to it, but I have to use SCORE to see my current experience. It looks like this:

Recruit Kaimarae (male Kingdom Human)
You are level 24 (Effervescent) and 52.75% of the way to the next level.
  Health:          924/924  Endurance:       235/235
  Magic:           964/964
You stand tall as a proud Peasant of Krondor.
You are a Runner in the Pathfinders, and 0% of the way to the next rank.
You are a Warlock Greater Path Magician.
You are a Landloper in the Fellowship of Explorers.
You are 17 years old, having been born on the 40th of Wochem, 1 years before the
Darkness at Sethanon.
You carry 25 copper in Kingdom currency.


Now, getting it to SCORE after each kill and capture the "52.75" with a wildcard is easy, currently doing that.. but results in a HUGE amount of screen space spammed with various things I don't care about.

I had an idea to get it to SCORE after each kill then save the information and omit it. But I still want to be able to check my score at other times.

My idea was to use a trigger to enable a Omit Score variable, which disables at the end but I'm not sure how to go about omitting AND still getting the experience percentage. Any ideas?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 15 May 2011 03:58 AM (UTC)

Amended on Sun 15 May 2011 03:59 AM (UTC) by Nick Gammon

Message
You can still use information from a trigger if it is omitted, no problem there.

You really need four triggers in your case, I think. All usually disabled.

After a battle and you have sent "score" enable trigger #1 and #2.

Trigger #1 omits from output and enables triggers #3 and #4.

Trigger #2 omits from output and remembers your experience.

Triggers #3 and #4 omit from output.

Trigger #4 disables all four triggers (including itself) to revert to normal operation.


Trigger #1: match: Recruit Kaimarae (male Kingdom Human)

Trigger #2: match: You are level * (*) and *% of the way to the next level.

Trigger #3: match: *

Trigger #4: match: You carry * in Kingdom currency.


Make trigger #2 have a lower priority than trigger #3 so it detects the experience line before the "match all" line.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #2 on Sun 15 May 2011 04:00 AM (UTC)

Amended on Sun 15 May 2011 04:01 AM (UTC) by Twisol

Message
Well, I just had a whole response typed up, but I hit the wrong button... :| ([EDIT]: Gah, Nick!)

Basically, you want to do the same thing as my MapWindow plugin. You have three triggers: a "start" trigger, a "middle" trigger that matches anything and everything, and an "end" trigger that matches the prompt. In your case, the "start" trigger would be:
^Recruit Kaimarae \(male Kingdom Human\)$

The "middle" and "end" triggers start out disabled. When the "start" trigger matches, it enables the two others (and optionally disables itself). The "middle" trigger gags everything. The "end" trigger disables itself and "middle", and re-enables "start".

It's important that all of these triggers have "Keep evaluating" checked, especially "middle". "Keep evaluating" tells MUSHclient to keep looking for other triggers that match the same line, and I recommend it be enabled for every trigger you ever create unless you have a good reason.

Once that's done, you can add a trigger for getting your experience, which you already have.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #3 on Mon 16 May 2011 01:35 AM (UTC)

Amended on Mon 16 May 2011 01:38 AM (UTC) by Kaimarae

Message
You people are legendary. Seriously. I cannot believe how useful this forum has been/is. Thank you so much :D

EDIT: When you say enables the triggers, is there a command (Lua) that enables other triggers... Currenly I'm just using variables set to 'true' or 'false' and using "if GetVariable("blahblah") == 'blah' then" statements. A command would be a lot simpler... Heh.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #4 on Mon 16 May 2011 01:48 AM (UTC)
Message
Yep. EnableTrigger("trigger's label", true) and EnableTrigger("trigger's label", false). You can also enable/disable a whole group using EnableTriggerGroup("group", true).

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #5 on Mon 16 May 2011 01:54 AM (UTC)
Message
That's pretty awesome. I love the simple Lua syntax. Everything just makes sense xD
Enable trigger? EnableTrigger.
Brilliant.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #6 on Mon 16 May 2011 01:57 AM (UTC)
Message
And then you go to disable a trigger and use EnableTrigger. ~_^

(No, really, you can fix that: DisableTrigger = function(label) return EnableTrigger(label, false) end)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #7 on Mon 16 May 2011 09:38 AM (UTC)
Message
That's pretty cool. Two things:

How do I set the priority? I thought it was Sequence... But that was mistaken. I think. Didn't work anyway.

It's all triggering and enabling/disabling just fine, but because I still want to check score, I made a trigger on "You have slain *" which enables the start trigger and does Send("SCORE"). Is it possible to hide the echo and therefore the extra line of prompt? Is a minor quibble.

Thanks lots :]
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #8 on Mon 16 May 2011 09:43 AM (UTC)
Message
Kaimarae said:
How do I set the priority? I thought it was Sequence... But that was mistaken. I think. Didn't work anyway.

A lower sequence actually means a higher priority, so a trigger with sequence 99 will always be processed before a trigger with sequence 100. Can you paste what you tried?
Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Kaimarae said:
Is it possible to hide the echo

Yes, use SendNoEcho(). (This doesn't apply if it's the MUD that's sending the echo.)

Kaimarae said:
and therefore the extra line of prompt?

Do you mean the prompt that comes after the SCORE output? If you change your "end" trigger to the prompt instead of the final line of the SCORE, you'll gag the prompt as well.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #9 on Mon 16 May 2011 10:03 AM (UTC)
Message
I went looking and found SendNoEcho myself actually. But the changing the end-trigger to the prompt I didn't think of. That works beautifully now.

This is what I tried:

Grab exp:
<triggers>
  <trigger
   group="Prompting"
   keep_evaluating="y"
   match="^You are level * and *% of the way to the next level\."
   name="EXPgrab2"
   omit_from_output="y"
   regexp="y"
   send_to="12"
   sequence="99"
  >
  <send>SetVariable("CurrentEXP", "%3")</send>
  </trigger>
</triggers>


Omit all else:
<triggers>
  <trigger
   enabled="y"
   group="Prompting"
   keep_evaluating="y"
   match="*"
   name="EXPgrab3"
   omit_from_output="y"
   send_to="12"
   sequence="100"
  >
  </trigger>
</triggers>


I tried different combinations of 99 and 100.

[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #10 on Mon 16 May 2011 10:10 AM (UTC)
Message
Well, one's enabled by default and the other isn't. I think both should likely be disabled by default, and make sure you're enabling them both when the start trigger fires.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #11 on Mon 16 May 2011 10:16 AM (UTC)
Message
Well, I found two things going wrong there...

Trigger #2 wasn't being enabled (duhhh... God) and it was trying to update CurrentEXP with "%3"... notice there are only two wildcards in my match line... Haha, fixed that, but it's still not happening... Hrm.
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #12 on Mon 16 May 2011 10:19 AM (UTC)

Amended on Mon 16 May 2011 10:21 AM (UTC) by Kaimarae

Message
In other news, I can't edit any of those triggers now... Just says:

Quote:
The trigger named "expgrab2" has already been modified by a script subroutine.


... The hell?

I wonder if the difference between "expgrab2" (what it's being called) and "EXPgrab2" (what it IS called) makes any difference...

EDIT: It uh... Stopped doing that. Nevermind. :/
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #13 on Mon 16 May 2011 10:24 AM (UTC)

Amended on Mon 16 May 2011 10:25 AM (UTC) by Twisol

Message
Mind pasting the whole set of triggers, and an example SCORE output (plus prompt)?

[EDIT]: I also find it useful to stick to lowercase letters with underscores to avoid any accidents. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Kaimarae   (34 posts)  [Biography] bio
Date Reply #14 on Mon 16 May 2011 10:32 AM (UTC)

Amended on Mon 16 May 2011 10:36 AM (UTC) by Kaimarae

Message
I think I've narrowed it down. Everything is working hunkey-dorey... EXCEPT the experience catching line isn't triggering (according to trace). Disabled trigger "*" to see if it was overriding, it isn't. Which meeeans my trigger is probably wrong. This is the line:

You are level 25 (Significant) and 34.46% of the way to the next level.


I'm trying to match with this:

^You are level * and *% of the way to the next level.$


I have also tried with:

^You are level * \(*\) and *\% of the way to the next level\.$


Any idea what I'm doing wrong? (Regular Expression is checked)

EDIT: Jeeeesus. Just copy/pasted the line exactly and it still isn't matching. :|
[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.


52,846 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 HostDash]