|
Alien Bait Newbie
Joined: 21 Aug 2004 Posts: 5
|
Posted: Sat Aug 21, 2004 2:44 pm
Damage Calculator |
Ok, im not very trigger literate can someone help me out?
I want to have a trigger that calculates how much damage im taking, So when my hp drops, it tells me *perferably in a gauge* how much it dropped by, so if my current hp is at 400 and i get hit and my hp goes down to 124 the gauge would display -276 would be nice if it could also track increases in hp too, if anyone is willing to help me that would be great! thank you. |
|
|
|
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Sat Aug 21, 2004 4:09 pm |
You haven't given us any text to trigger off! And what circumstances this text is produced under.
Essentially you need a trigger that captures your current hps (I guess you have it in your prompt?) into a variable, and sets another variable to the old value of the first variable: Something like @CurrentHps and @LastHps. Then it just does the math and stores to another variable, which you display in some guage, or you can do the math in the guage itself. |
|
|
|
Alien Bait Newbie
Joined: 21 Aug 2004 Posts: 5
|
Posted: Sat Aug 21, 2004 4:29 pm |
sorry for not giving a string to trigger off of, like i said i have no clue on how to do this stuff really if im not giving you everything you need please let me know!
the hp/st/sp thing looks like this <1773hp 1920sp 1037st> |
|
|
|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Sat Aug 21, 2004 6:52 pm |
install this: (note: this is coded for NightmareLPMud so it will make it so you have this added onto it: gp: //) but i'm sure with some editing you could take it out
click here to see the code |
|
|
|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Sat Aug 21, 2004 6:56 pm |
it will make your status look like this: (the hp/sp/mp will be your actual mp/sp/hp)
hp: 460/460/AMOUNT-CHANGED-HERE mp: 740/740/AMOUNT-CHANGED-HERE sp: 420/420/AMOUNT-CHANGED-HERE |
|
|
|
Alien Bait Newbie
Joined: 21 Aug 2004 Posts: 5
|
Posted: Sat Aug 21, 2004 7:31 pm |
:( i tried that, but i couldnt get it to do anything but sit there being 0%
|
|
|
|
geniusclown Magician
Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Sat Aug 21, 2004 9:00 pm |
Quote: |
#TR {~<&%d{hp}hp &%d{sp}sp &%d{st}st~>} {
#IF (@hp<>@lasthp) {#ECHO HP has changed by %eval(@lasthp - @hp)!;lasthp=@hp}
#IF (@sp<>@lastsp) {#ECHO SP has changed by %eval(@lastsp - @sp)!;lastsp=@sp}
#IF (@st<>@lastst) {#ECHO ST has changed by %eval(@lastst - @st)!;lastst=@st}
} |
You will probably want to change what it does to notify you that your points have changed, but you get the idea of how to figure it.
If you want a gauge for each, you'll first need to set the maximum values of each (i.e. create variables hpmax, spmax, and stmax). I'm not good at creating buttons from the command line, but I'll describe how to set up a gauge for HP through the Settings editor - the other two settings will work identically.
First, in the Settings window, select the Class you want your button to be a member of, and then select "New Button" from the New drop-down menu.
Change the "Kind" to a gauge.
Give your button a Caption. The caption can be simple and static, like "HP". Or, you can add in variables, like "HP: @hp". If you want it to display how much it changed, do this: in the trigger above, change the HP bit to "#IF (@hp<>@lasthp) {hpchange=%eval(@lasthp-@hp);lasthp=@hp}", then you can make your caption: "HP: @hpchange". Once you're done, the gauge will still show what your HP is in relation to your max.
Click on the Gauge tab in Edit Button.
The Value is @hp.
The Gauge Max is @hpmax.
Gauge Low is optional, and you can make it a particular number of hp's, or maybe 1/4 of your max by giving it a value of "%eval(@hpmax/4)".
Click on the Position/Size tab, and tweak the settings to your preference.
I hope this helps! |
|
_________________ .geniusclown |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Aug 21, 2004 10:27 pm |
Heres is a rewrite for you of what I use :P
#TR {~<(%d)hp (%d)sp (%d)st> {
prompt.hpc=%eval( %1-@prompt.hp)
prompt.hp=%1
prompt.spc=%eval( %1-@prompt.sp)
prompt.sp=%2
prompt.stc=%eval( %1-@prompt.st)
prompt.st=%3
#PSUB {%1/@prompt.hp} %x1
#PSUB {%2/@prompt.sp} %x2
#PSUB {%3/@prompt.st} %x3} "" {prompt|nocr} |
|
|
|
Alien Bait Newbie
Joined: 21 Aug 2004 Posts: 5
|
Posted: Sun Aug 22, 2004 11:58 am |
GeniusClown i couldnt get the gauges to work correctly, maybe im missing somthing, or just stupid cause it works outside of the gauges,
Nexula when i try to use the one you shown me my mud freezes :P |
|
|
|
geniusclown Magician
Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Sun Aug 22, 2004 2:55 pm |
How are they not working correctly? Are you able to create the buttons and make them look how you want (position and size)? Can you find all the settings I described? Is the gauge adjusting as expected, or staying a solid color, or part one color and part another color?
Look through the Help docs. On the Contents Tab, select Settings, then Buttons, then Buttons (under Buttons). Read through all the sections there, and maybe you'll understand them well enough to troubleshoot them yourself. |
|
_________________ .geniusclown |
|
|
|
Alien Bait Newbie
Joined: 21 Aug 2004 Posts: 5
|
Posted: Sun Aug 22, 2004 3:18 pm |
I think im just misunderstanding what im sposed to do with this:
#TR {~<&%d{hp}hp &%d{sp}sp &%d{st}st~>} {
#IF (@hp<>@lasthp) {#ECHO HP has changed by %eval(@lasthp - @hp)!;lasthp=@hp}
#IF (@sp<>@lastsp) {#ECHO SP has changed by %eval(@lastsp - @sp)!;lastsp=@sp}
#IF (@st<>@lastst) {#ECHO ST has changed by %eval(@lastst - @st)!;lastst=@st}
}
also where am i putting this?:
#IF (@hp<>@lasthp) {hpchange=%eval(@lasthp-@hp);lasthp=@hp} |
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Mon Aug 23, 2004 7:26 am |
Code: |
#TR {~<&%d{hp}hp &%d{sp}sp &%d{st}st~>} {
#IF (@hp<>@lasthp) {#ECHO HP has changed by %eval(@lasthp - @hp)!;lasthp=@hp}
#IF (@sp<>@lastsp) {#ECHO SP has changed by %eval(@lastsp - @sp)!;lastsp=@sp}
#IF (@st<>@lastst) {#ECHO ST has changed by %eval(@lastst - @st)!;lastst=@st}
}
|
Put that in your command line and press <Enter>. It will send you an #ECHO each time your hp, sp, or st change. That may get a little spammy. Leave out the sp #IF statement if you don't want to track sp . Leave out the st #IF statement if you don't want to track st.
If you want to create a #GAUGE instead of an #ECHO, then try this modification to geniusclown's code:
(I'm at work and cannot test this)
#VAR maxhp {}
#TR {~<&%d{hp}hp &%d{sp}sp &%d{st}st~>} {
#IF (@hp<>@lasthp) {hpchange=%eval(@lasthp-@hp);lasthp=@hp}
}
#GAUGE hpchange "@hpchange" "@maxhp"
Copy that into your command line and press <Enter>.
You'll also need to enter the value of your maxhp manually. Just type:
maxhp=1234
in the command line, replacing 1234 with your actual maxhp value, and press <Enter>.
This #GAUGE command should create a gauge titled "hpchange" overlayed with your current @hpchange value in black numbers (by default) with a maximum value of @maxhp. To edit the gauge properties, access the Settings Editor and select the button icon titled "hpchange" in the Editor Window.
The black numbers may be difficult to see on the gauge. I suggest changing the Caption Field on the Button States tab to make the ForeGround Color white (you can also change the Background Color). Click on the multi-colored box to do this. That will make the gauge's caption text white instead of black (easier to read). Play around with it until you find colors of your liking.
Remember, each time your maxhp increases you will have to update the value for @maxhp like above. |
|
_________________ zMUD 7.05a |
|
|
|
|
|