|
Zalandel Newbie
Joined: 19 Jan 2016 Posts: 1
|
Posted: Tue Jan 19, 2016 4:35 am
Status bar |
Hi, kinda new to CMUD and need assistance setting up my status bar to show current HP and GP values.
This is what scorebrief or monitor shows and what I am trying to get shown in my monitor bar (with accurate values)
Hp: 8470(8470) Gp: 8493(8493) |
|
|
|
Llohr Apprentice
Joined: 17 May 2005 Posts: 108
|
Posted: Tue Jan 19, 2016 8:27 am |
I'll go through this step by step as if you're extremely new to CMud, juse in case. If you already know all about pattern matching and can set up variables, then I apologize for wasting so much of your time :).
First you'll need to set up variables containing those values. I'll go over instructions to make your own trigger to do so before we get to the status bar itself.
I'll give directions based on using the package editor rather than the command line, because I use it myself primarily and can be sure things will behave as I expect. So, to make a trigger to capture HP and GP into variables, click on the "Triggers" button, and then the "New" button within the package editor. For the "pattern" portion of the trigger, enter this:
HP~:%s(%n)~(%n~)%sGP~:%s(%n)~(%n~)
Go ahead and save that trigger now with just the pattern.
So that you know what you're looking at there, any character preceded by a ~ is quoted, and thus is something that must appear on the screen to match the pattern. Special characters like parentheses and colons are used for other purposes in pattern matching or other parts of scripting, and it's generally a good idea to just go ahead and quote them in trigger patterns if you don't want them to be parsed.
The "%s" means means "Match any number of spaces." I included this in case the number of spaces in the mud output can vary. Say, for instance, your HP or GP drops below 4 digits. A space may or may not be added in that case by the mud. You would know better than I.
The "%n" means "Match any number," it can included a leading + or - sign and commas, so "-1,340,433" would be matched as a number just as "3" would. To the best of my knowledge, the same is not true of numbers with decimal points.
The first and third "%n" are surrounded by unquoted parentheses. This lets your trigger know that you want the values of those numbers remembered for use in the trigger. The second and fourth %n are surrounded by parentheses in your prompt, so those are quoted with tildes so that the trigger will look for them to match the pattern.
Now for the value of the trigger. The simplest method would be:
Hp=%1
Gp=%2
That tells CMud to create two variables, called "Hp" and "Gp" respectively. Then it sets the values of those variables to the first and second part of the pattern surrounded by (unquoted) parentheses.
When entering a trigger pattern, you can basically put parentheses around anything you like, and if you want to refer to them in the trigger, you figure out which number of parenthesis pairs the one you want to refer to is. That's just a terrible way to explain that, sorry. Okay, if you have five items surrounded by parentheses in your pattern, and you want to refer to the fifth one, you use %5. The fourth? %4. Etc.
Now then, with that trigger pattern and value complete, you CAN check "Trigger on prompt" and uncheck "Trigger on Newline" so that the variable values are updated the instant you can see them. It isn't necessary, but using "Trigger on Newline" will wait for another line following the one that matches the pattern before executing the trigger.
Now, the easiest way to set up your status bar would be to enter:
#status {Hp: @Hp Gp: @Gp}
into your command line and hit enter.
Or, if you want to use the package editor again, you can click the "triggers" button (or "aliases"/"Variables"/"Paths"/"Macros"/"Buttons", they all go to the same, they just select a different thing to look at). Now click the little down arrow next to "New," and select "New Status Bar." then enter:
Hp: @Hp Gp: @Gp
as its value. You can give it whatever name you like as its name, that won't show up on your status bar. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4702 Location: Pensacola, FL, USA
|
Posted: Tue Jan 19, 2016 1:26 pm |
You could also extend that concept out and capture the maximum values for your various points as well (with more parenthesis).
You could then make a button of type gauge that gives a visual representation of what percentage is left now that you have a current and maximum value stored.
Buttons have a lot more options when it comes to where you want the information displayed. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|