Status bar

by Navaryn

Back to Mechanic's Corner.

Navaryn2005-03-16 15:31:03
I'm trying to create status bars in zMud. I swear i looked through all the tutorials and menu, i can't find a clue about how to create them.

The status bars i am trying to create would look like the ones in java (you know, for health, mana, willpower and endurance). Could anyone help me please?
Unknown2005-03-16 18:37:20
Ahh, then you're looking for gauges. I don't have enough time now, but I suggest reading through the button-related help files in zMUD, as a gauge is a button.

Basically, create a button, and then change its type to gauge...
Navaryn2005-03-16 19:04:50
Ahh, yes. Gauge is the word, sorry heh.

Thanks, i'll do that.
Unknown2005-03-17 07:42:17
Are you still having trouble with it?
Drago2005-03-17 07:59:43
*hum*

Technically the status bar is the little thing that floats above your command line which you can add things to with #STAT.. like.. this:
CODE
#STAT {Level: @level || Exp: @xp || Gold from Rats/Weevils: @goldw || Target: @tar || Criticals: @criticals || Rats killed here: @rats || Stance: @stance || Power: @power} {} "Status Bar"


I should get rid of the rat stuff, considering that I like.. don't rat

And you can make your nifty statuswindow with that as well, just dump whatever you like in the empty set of {}.
Unknown2005-03-17 08:16:29
If you read, that isn't what he means...
Drago2005-03-17 08:20:30
I know, but its always good to know.

Plus it adds to mah keys, mmhmm
celahir2005-03-17 12:31:53
First of all make the variables you will need these will look like:
CODE

#var Currenthealth ""
#var Maxhealth ""
#var CurrentMana ""
#var MaxMana ""


Then you want a trigger to read the prompt this would look something like this:
CODE

#TRIGGER {^(%d)h, (%d)m, (%d)p(*)~-} {Currenthealth=%1;CurrentMana=%2} "" {nocr|prompt}


The (%d) are wildcards that pick up the numbers in the prompt and assign them to the variables.

The {nocr|prompt} means that it will always read the prompt as otherwise it will read it as a newline which means the trigger wont always work.

You then want to be able to read the score to update your MaxHealth and MaxMana
to do this create a class that will turn on when you press score and off afterwards.
This will look like:

CODE

#ALIAS (score) {#class ScoreTracker 1;~score}
#CLASS {ScoreTracker} {disable}
#TRIGGER {Health : (%d)/(%d)} {healthmax=%2}
#TRIGGER {Mana   : (%d)/(%d)} {manamax=%2;#CLASS ScoreTracker 0}
#CLASS 0


The {disable} means that the class will start turned off and will only turn on when score is typed then it wil turn off again. Finally you want the buttons are hard to write in code and so ill put the steps in for you.

1) When on the normal screen press the buttons button at the top to go into the editor.

2) Select a new button simply by pressing new

3) In the button editor for the new button there is a drop down box select gauge from it.

4) Now call the button whatever you want and go to the last tab in the editor

5) Select for the variable it reads from to be @currenthealth and its maximum to be @healthmax then changes the colours and such till your happy.

6) Now do the same for Mana

I'm not near my zmud screen as I write this so it may be a bit wrong but if you know enough you should know what to do.

Post again if you have any problems with this or want me to explain any of it.
Navaryn2005-03-17 21:06:47
Thanks for helping!

There is something odd though... My gauges never go down. I always seem to be at full health/mana despite my prompt saying otherwise huh.gif

Any idea why?
Summer2005-03-17 22:48:06
You got afflicted with the zMud form of recklessness wink.gif

Just kidding. I haven't got the least idea.
Navaryn2005-03-17 23:13:14
QUOTE(Summer @ Mar 17 2005, 05:48 PM)
You got afflicted with the zMud form of recklessness wink.gif

Just kidding. I haven't got the least idea.
75454



Heh i knew i would get that reply whip.gif
Summer2005-03-17 23:46:47
Ow! crying.gif

It's mean to whip anyone called Summer.
Unknown2005-03-18 03:42:45
Celahir screwed up the alias syntax, so it never captured your max stats to compare your current with (and some other weird things). wink.gif Here is Celahir's example with additions and capturing most prompt:

CODE

#CLASS Gauges
#VARIABLE Health 0
#VARIABLE MaxHealth 0
#VARIABLE Mana 0
#VARIABLE MaxMana 0

#TRIGGER {^(%d)h, (%d)m*-} {#VARIABLE Health %1;#VARIABLE Mana %2} "" {nocr|prompt}

#ALIAS {score} {#T+ Gauges|Score;~score}
#CLASS 0

#CLASS {Gauges|Score} {disable}
#TRIGGER {Health%s:%s(%d)/(%d)} {#VARIABLE Health %1;#VARIABLE MaxHealth %2}
#TRIGGER {Mana%s:%s(%d)/(%d)} {#VARIABLE Mana %1;#VARIABLE MaxMana %2;#T- Gauges|Score}
#CLASS 0

Wait, Celahir's script screwed up about 20 times. tongue.gif

First, the alias syntax is #ALIAS {name} {do}, not #ALIAS (name) {do}. Next, the prompt wouldn't match someone who doesn't have power in it. Then, to disable/enable classes you go #T+ class/#T- class, I've never seen #CLASS class 1/#CLASS class 0 before. :S Next, he called the MaxHealth/MaxMana variables as healthmax/manamax instead, so that screwed it. And then he put spaces in between the Mana/Health, the : and the (%d)/(%d), yet these spaces sometimes change in length, so use %s instead. And finally, there should be a #T- Gauges|Score at the end to disable it once whoever begins using it. biggrin.gif

EDIT: Also, there were unnecessary capturing brackets in some places.
Navaryn2005-03-18 05:02:08
Just to be sure, Zaltan, you're saying that what i should put in my code is what is in the CODE window you included in your post?
Drago2005-03-18 05:30:13
First, to Navaryn, yes.

Second, to Zaltan, from the Class help file -
#CLASS Automapper 1
Turns on the Automapper class.
Unknown2005-03-18 05:50:53
QUOTE(Navaryn @ Mar 18 2005, 06:02 PM)
Just to be sure, Zaltan, you're saying that what i should put in my code is what is in the CODE window you included in your post?
75759


Yes, what Drago said, and delete the other gauge stuff, as this is basically an 'upgrade'. tongue.gif

#CLASS Classname 1? Bleh, I've never seen that before. Anyway, #T+ is a hell of a lot quicker. wink.gif
Navaryn2005-03-18 07:08:39
*sigh* this is hopeless. No matter what i do, it doesn't work. I think i'll just have to spend TONS of time studying zMud trying to understand that language.

Thanks for the help, anyway!
Drago2005-03-18 07:45:02
CODE
#CLASS Gauges
#BUTTON 200 {Health: @Health} {} {} {} {@health} {} {} {} {} {} {Pos} {0} {0} {32798} {} {Gauge||12|@MaxHealth|@MaxHealth-|0} {} "" {Explore|Inset} {} {} {2}
#BUTTON 300 {Mana: @Mana} {} {} {} {@Mana} {} {} {} {} {} {Pos} {0} {131} {32817} {} {Gauge||14|@MaxMana|@MaxMana-|0} {} "" {Explore|Inset} {} {} {2}
#VARIABLE Health 0
#VARIABLE MaxHealth 0
#VARIABLE Mana 0
#VARIABLE MaxMana 0
#TRIGGER {^(%d)h, (%d)m*-} {#VARIABLE Health %1;#VARIABLE Mana %2} "" {nocr|prompt}
#ALIAS {score} {#T+ Gauges|Score;~score}
#CLASS 0
#CLASS {Gauges|Score} {disable}
#TRIGGER {Health%s:%s(%d)/(%d)} {#VARIABLE Health %1;#VARIABLE MaxHealth %2}
#TRIGGER {Mana%s:%s(%d)/(%d)} {#VARIABLE Mana %1;#VARIABLE MaxMana %2;#T- Gauges|Score}
#CLASS 0
Try it like that instead. For some reason having a blank line buggers things up sometimes.

That all should work.
celahir2005-03-18 10:01:04
Heh sorry I was writing it off memory with zmud 2 miles away :S
Also #class does work it was added a while to affect classes only try it!

They added it when classes could hold more then triggers as otherwise if you have a trigger with the ID called Class1 and a class called Class1 for example ( I know it isnt likely just an example) both can be affected by #T while only #Class can be affected otherwise. Prevents bugs.
Navaryn2005-03-18 21:27:08
QUOTE(Drago @ Mar 18 2005, 02:45 AM)
CODE
#CLASS Gauges
#BUTTON 200 {Health: @Health} {} {} {} {@health} {} {} {} {} {} {Pos} {0} {0} {32798} {} {Gauge||12|@MaxHealth|@MaxHealth-|0} {} "" {Explore|Inset} {} {} {2}
#BUTTON 300 {Mana: @Mana} {} {} {} {@Mana} {} {} {} {} {} {Pos} {0} {131} {32817} {} {Gauge||14|@MaxMana|@MaxMana-|0} {} "" {Explore|Inset} {} {} {2}
#VARIABLE Health 0
#VARIABLE MaxHealth 0
#VARIABLE Mana 0
#VARIABLE MaxMana 0
#TRIGGER {^(%d)h, (%d)m*-} {#VARIABLE Health %1;#VARIABLE Mana %2} "" {nocr|prompt}
#ALIAS {score} {#T+ Gauges|Score;~score}
#CLASS 0
#CLASS {Gauges|Score} {disable}
#TRIGGER {Health%s:%s(%d)/(%d)} {#VARIABLE Health %1;#VARIABLE MaxHealth %2}
#TRIGGER {Mana%s:%s(%d)/(%d)} {#VARIABLE Mana %1;#VARIABLE MaxMana %2;#T- Gauges|Score}
#CLASS 0
Try it like that instead. For some reason having a blank line buggers things up sometimes.

That all should work.
75859




Okay, i don't care what other people think of me, i AM putting a shrine to you in my room for this biggrin.gif .

Thanks a lot! It works cheer.gif