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
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Fri Dec 25, 2009 4:49 pm   

Help with Gauges
 
New to scripting and I need some help. I am trying to get a Health gauge to work. What I have is this:

Caption: hp Type: Gauge Language: zScript
Value: @hp
Max: @maphp
Low: @maxhp/30

The game I'm trying to set this for is MidkemiaOnline (open beta).
The command line looks like this: 352 health, 346 endurance, 88 faith xb-

Now what do I need to do in order to get my gauge to actually work? How does it get my hp data from the game?

Thanks
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Dec 25, 2009 5:13 pm   
 
You need to use a trigger to get the variables populated.

#trigger {^(%d) health, (%d) endurance, (%d) faith xb-} {hp = %1;endurance = %2;faith = %3}

If you can change the prompt to show max amounts as well, or even a percent, you can have your gauge working with just this trigger. If you cannot change the prompt, you need to make another trigger to capture the value elsewhere.
_________________
EDIT: I didn't like my old signature
Reply with quote
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Fri Dec 25, 2009 5:45 pm   
 
Quote:

If you can change the prompt to show max amounts as well, or even a percent, you can have your gauge working with just this trigger. If you cannot change the prompt, you need to make another trigger to capture the value elsewhere.


It seems I'm unable to config the prompt to display current/max or in a percent. It only displays the current amount. using the Score command it does however show current/max, is that where I'm going to need to pull the "max" from?

Graugs (male Stone Mountain Dwarf)
You are level 7 (Innocuous) and 11.92% of the way to the next level.
Health: 405/405 Endurance: 387/387
Faith: 17/100
You stand tall as a proud Peasant of Krondor.
You are a Runner in the Pathfinders.
You are a Priest.
You are a Vagrant in the Fellowship of Explorers.
You are 17 years old, having been born on the 29th of Wochem, 12 years before
the Darkness at Sethanon.
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sat Dec 26, 2009 12:05 am   
 
Yes, since MKO is not sending Character Vitals over ATCP, you will have to get your max values from the score.
Reply with quote
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Mon Dec 28, 2009 3:42 am   
 
Ok, I'll keep trying. I still haven't figured out how to capture that output from the score. I think I really only need to have it captured when I level up or perhaps have the "max" captured/updated whenever I type score. Since I'm new at this stuff, and only understand a very little of it, I'm guessing I use a trigger to accomplish this task? Or is there some easy way of doing it that I'm overlooking? If you say triggers are easy.... I'm hunt'n ya down! :-P
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Mon Dec 28, 2009 3:50 am   
 
Triggers are.....what you need. I trigger the status lines from SCORE, and then when I level or end combat I automatically check it.
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Mon Dec 28, 2009 4:08 pm   
 
this is how i'd do it... unless there is a better way, if so, please chime in so i can update my stuff, hahaha!! hth's!


Code:
<class name="Variables" id="1170">
  <var name="hp" id="400">0</var>
  <var name="maxhp" id="401">0</var>
  <var name="lowhp" id="402">@hp/30</var>
  <var name="end" id="403">0</var>
  <var name="maxend" id="404">0</var>
  <var name="lowend" id="405">0</var>
  <var name="fai" id="406">0</var>
  <var name="maxfai" id="407">0</var>
  <var name="lowfai" id="408">@fai</var>
  <var name="age" id="409">0</var>
</class>

<class name="Triggers" id="1171">
  <trigger priority="3800" id="380">
    <pattern>^You are &%dage years old, having been born on the 29th of Wochem, %d years before
the Darkness at %w.$</pattern>
      <value>#T- he_trigger;#T- f_trigger</value>
  </trigger>
  <trigger priority="3800" id="381">
    <pattern>^Graugs ~(male Stone Mountain Dwarf~)$</pattern>
      <value>#T+ he_trigger;#T- f_trigger</value>
  </trigger>
  <trigger name="he_trigger" trigger priority="3800" id="382">
    <pattern>^Health: &%dhp~/&%dmaxhp Endurance: &%dend~/&%maxend<pattern>
  </trigger>
  <trigger name="f_trigger" trigger priority="3800" id="383">
    <pattern>Faith: &%dfai~/&%maxfai</pattern>
  </trigger>
  <trigger name="prompt" priority="420" case="true" newline="false" prompt="true" id="284">
    <pattern>&%dhp health, &%end endurance, &%fai faith xb~-$</pattern>
  </trigger>
</class>

<class name "Guage" id="1172">
  <button type="Gauge" autosize="false" width="200" height="24" autopos="false" iconleft="false" transparent="false" color="lime" gaugelowcol="red" gaugebackcol="yellow" priority="4990" id="490">
    <caption>Health: @hp ~/ @maxhp</caption>
    <expr>@hp</expr>
    <gaugemax>@maxhp</gaugemax>
    <gaugelow>@lowhp</gaugelow>
    <tooltip>Health Points</tooltip>
  </button>
  <button type="Gauge" autosize="false" width="200" height="24" autopos="false" top="24" iconleft="false" transparent="false" color="lime" gaugelowco="red" gaugebackcol="yellow" priority="4990" id="491">
    <caption>Endurance: @end ~/ @maxend</caption>
    <expr>@end</expr>
    <gaugemax>@maxend</gaugemax>
    <gaugelow>@lowend</gaugelow>
    <tooltip>Endurance Points</tooltip>
  </button>
  <button type="Gauge" autosize="false" width="200" heigh="24" autopos="false" top="48" iconleft="false" transparent="false" color="lime" gaugelow="red" gaugebackcol="yellow" priority=4990" id="492">
    <caption>Faith: @fai ~/ @maxfai</caption>
    <expr>@fai</expr>
    <gaugemax>@maxfai</gaugemax>
    <gaugelow>@lowfai</gaguelow>
    <tooltip>Faith Points</tooltip>
</class>
Reply with quote
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Tue Dec 29, 2009 3:58 am   
 
Thanks all... Now, I realize when you look at that code you see blonde, brunett, redhead... but I can't read code before the construct yet. ;-)

I see there are variables, triggers, and gauges/buttons, but where would I copy/paste that code? I've tried copying lines/sections and pasting them in what I thought would be the appropriate places... I was wrong. Embarassed Sorry, I'm a newb!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Dec 29, 2009 8:10 am   
 
just copy the entire thing to the clipboard and then press CTRL-P with the focus on the settings treeview (the list of triggers, classes, aliases, etc on the left) in the Package Editor.
_________________
EDIT: I didn't like my old signature
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Tue Dec 29, 2009 1:59 pm   
 
actually, i'm missing something. the last two lines of the code should look like this:

Code:
    <tooltip>Faith Points</tooltip>
  </button>
</class>


so sorry about that. probably doesn't help with copy/paste without that... lol
Reply with quote
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Tue Dec 29, 2009 7:52 pm   
 
Can't copy/paste the triggers or gauge sections. There are errors:
for the trigger section, File:. Line: 3 Col:29 Error: Expected String: ';'

For the button section, File:. Line: 1 Col: 13 Error: Expected String: '='

I was able to copy the variable section and "paste" it in. That created the variables.

EDIT: for update.
I have used the information in the triggers and gauges sections to manually create each one. The gauges are in place but show 0/0 for my health, end, and faith. Two of the triggers are greyed out with lines through them. They are the "f_trigger" and the "he_trigger"

Thank you all for your input and patience on this. Very Happy


Last edited by Tarqueth on Tue Dec 29, 2009 11:13 pm; edited 1 time in total
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Tue Dec 29, 2009 10:56 pm   
 
ah yes... love typo's. i apologize, i didn't have a computer that had cmud on it, so i wasn't able to test it, i just typed it out. i verified this for you. =D

Code:
<window name="test">
  <class name="Variables" id="1">
    <var name="hp" id="2">0</var>
    <var name="maxhp" id="3">0</var>
    <var name="lowhp" id="4">@hp/30</var>
    <var name="end" id="5">0</var>
    <var name="maxend" id="6">0</var>
    <var name="lowend" id="7">@end/30</var>
    <var name="fai" id="8">0</var>
    <var name="maxfai" id="9">0</var>
    <var name="lowfai" id="10">@fai/30</var>
    <var name="age" id="11">0</var>
  </class>
  <class name="Guage" id="12">
    <button type="Gauge" autosize="false" width="200" height="24" autopos="false" iconleft="false" transparent="false" color="lime" gaugelowcol="red" gaugebackcol="yellow" priority="4992" id="13">
      <caption>Health: @hp ~/ @maxhp</caption>
      <expr>@hp</expr>
      <gaugemax>@maxhp</gaugemax>
      <gaugelow>@lowhp</gaugelow>
      <tooltip>Health Points</tooltip>
    </button>
    <button type="Gauge" autosize="false" width="200" height="24" autopos="false" top="24" iconleft="false" transparent="false" color="lime" gaugelowcol="red" gaugebackcol="yellow" priority="4991" id="14">
      <caption>Endurance: @end ~/ @maxend</caption>
      <expr>@end</expr>
      <gaugemax>@maxend</gaugemax>
      <gaugelow>@lowend</gaugelow>
      <tooltip>Endurance Points</tooltip>
    </button>
    <button type="Gauge" autosize="false" width="200" height="24" autopos="false" top="48" iconleft="false" transparent="false" color="lime" gaugelowcol="red" gaugebackcol="yellow" priority="4990" id="15">
      <caption>Faith: @fai ~/ @maxfai</caption>
      <expr>@fai</expr>
      <gaugemax>@maxfai</gaugemax>
      <gaugelow>@lowfai</gaugelow>
      <tooltip>Faith Points</tooltip>
    </button>
  </class>
  <class name="Triggers" id="16">
    <trigger name="prompt" priority="160" id="17">
      <pattern>&amp;%dhp health, &amp;%end endurance, &amp;%fai faith xb~-$</pattern>
    </trigger>
    <trigger priority="170" id="18">
      <pattern>^Graugs ~(male Stone Mountain Dwarf~)$</pattern>
      <value>#T+ he_trigger;#T- f_trigger</value>
    </trigger>
    <trigger name="he_trigger" priority="180" id="19">
      <pattern><![CDATA[^Health: &%dhp~/&%dmaxhp Endurance: &%dend~/&%maxend]]></pattern>
    </trigger>
    <trigger name="f_trigger" priority="190" id="20">
      <pattern>Faith: &amp;%dfai~/&amp;%maxfai</pattern>
    </trigger>
    <trigger priority="200" id="21">
      <pattern>^You are &amp;%dage years old, having been born on the 29th of Wochem, %d years before the Darkness at %w.$</pattern>
      <value>#T- he_trigger;#T- f_trigger</value>
    </trigger>
  </class>
</window>
Reply with quote
Tarqueth
Newbie


Joined: 24 Dec 2009
Posts: 6
Location: AZ

PostPosted: Tue Dec 29, 2009 11:34 pm   
 
Ok, removed all of my previous var/tr/gauges and copy/pasted this lastest version in there... it copied everything nice, but I still am not getting any numbers displayed in the gauges. I typed in "score" thinking that's what would populate the gauges. Any idea's?
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Wed Dec 30, 2009 1:59 am   
 
well... looks good to me, but i can't test it. =]

here's what you need to remember. ^ is at the beginning and $ is at the end. take those out, until you can get the trigger working, then put them back in, after they work (more stable triggers, and you won't get trigger f**ked)

also, what i will do if i'm having trouble with a trigger, is i'll put this in my body:
Code:
#say Got the trigger!!


then start trimming down the trigger until you get it, and go from there.

also, unsure, but make sure that the trigger called "prompt" is triggering on the line, there is a check mark box for trigging on that line. hth's....
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