Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
jalong08
Newbie


Joined: 12 Jan 2013
Posts: 3

PostPosted: Sat Jan 12, 2013 12:39 am   

Gauge help Realms of Despair
 
stuck and need help, here is my prompt

<40/40hp 84/130m 130/130mv 11,050to level>

trying to make a health, mana, move ment and exp bar to keep track of them and i'm totally new to scripting lol. any help would be greatly apreciated.
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 108

PostPosted: Wed Jan 16, 2013 3:16 am   
 
Well, I'm a novice as far as gauges go, I just decided to make a couple myself, which I'm not really using in the intended manner (on/off indicator and such).
However, I think this should be a pretty simple set of gauges to set up, apart from the exp bar.

Now, I know cmud has a built in method of keeping track of the values in your prompt, but I personally have shied away from using in favor of just making my own triggers.

There can be some issues with triggers based on the space between the different parts of your prompt, on some MUDs you might find that you have an extra space after a value drops below the maximum number of digits, and so forth, but assuming that spaces remain constant, the trigger:

Code:
#trigger prompt {~<(%n)~/(%n)hp (%n)/(%n)m (%n)/(%n)mv (%n)to level~>} {#var hp {%1} {_nodef} {PromptValues};#var maxhp {%2} {_nodef} {PromptValues};#var mp {%3} {_nodef} {PromptValues};#var maxmp {%4} {_nodef} {PromptValues};#var mv {%5} {_nodef} {PromptValues};#var maxmv {%6} {_nodef} {PromptValues};#var exp {%7} {_nodef} {PromptValues}} PromptValues prompt


would suffice to capture the values for use in gauges. Note: this example creates a class named "PromptValues" to facilitate turning everything on and off. At that point, the standard helpfile example of a gauge would work to create them. Thus something like the exact example given in the help file for the #gauge command:
Code:

 #GAUGE hp "hp" @hp @maxhp (@maxhp/10) "" "blue" "red"
would create a blue hp tracking gauge that turns red if your current hp falls below a tenth of max hp. The #gauge help file also shows what each of the fields after #gauge actually does, but you could probably just use that example, and then click on the "buttons" button to look at the gauge and edit it in the handy gauge editor easily enough.

The process can be expanded to mana by simply changing the variable @hp to @mp, and changing @maxhp into @maxmp, and so on with movement points. I found that some experimentation was required for positioning of multiple gauges, but you can really just click away until your heart's content until you get things the way you want them. If you somehow screw it up beyond redemption, just delete the gauge and repaste #gauge command and off you go again.

I'm not entirely certain what you'd be looking for in an experience gauge. Is there a maximum amount of experience you'd be counting up to? Does exp accumulate throughout your levels, or reset to zero after each? Assuming that doesn't matter, and that the maximum is a readily locatable quantity denoting the point of next level-up, you'd need to create a trigger or alias (or simply variable, if you like typing) to track that quantity, at which point such a gauge could be created much like the others. Sadly I haven't found a way to make a gauge that smoothly transitions from one color to another as it increases or decreases, so you couldn't make an exp gauge that starts out black as despair and gradually shifts toward a brilliant gold of glory as you near the point of leveling up. If your goal is to simply list the amount of exp you currently have, you could use a status bar even more easily than a gauge, but I admit a gauge is much flashier.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Wed Jan 16, 2013 3:17 am   
 
gauges are far easier to make via the GUI in the editor than by a line of zscript
_________________
Discord: Shalimarwildcat
Reply with quote
jalong08
Newbie


Joined: 12 Jan 2013
Posts: 3

PostPosted: Wed Jan 16, 2013 7:43 am   
 
As far as the exp bar, it always counts down to zero so it's a set value the variable is the number shown
Reply with quote
jalong08
Newbie


Joined: 12 Jan 2013
Posts: 3

PostPosted: Wed Jan 16, 2013 7:44 am   
 
Also thank you for your reply, I'll test it as soon as I wake up.
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 108

PostPosted: Thu Jan 17, 2013 9:13 pm   
 
That's actually a bit tougher than anything I had considered. If you have some way to check the total xp required from the beginning of each level, you could use that as a "Max" value, otherwise, you're just looking at a gauge that has the same max value and current value, i.e., a bar that's always at 100%.

Thinking in terms I'm used to, where accrued experience increases the total, there are some ways to make a workable gauge--I don't think calling current exp a negative number would work. If you know the total amount of exp required to get from the start of one level to the next, you can set that as maxexp, then subtract current exp from max exp to get an alternative version of current exp, which would actually represent the amount of exp gained thus far.

Or, you could simply make a gauge that changes color once it reaches a certain number, to indicate that you're near level. That would be more of an on/off indicator than a gauge, but I do use them in that way sometimes.

Otherwise, someone who uses gauges a lot more than me probably has a much better idea of what to do here. It may be that the gauge system was designed for this sort of thing and I don't know because I've never encountered it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net