|
Daarte Beginner
Joined: 09 Jul 2008 Posts: 10
|
Posted: Wed Jul 09, 2008 2:37 pm
Counting Damage |
Hi, here is my problem.
I have a prompt line, pretty stock, showing my health and mana (556hp - 732mn)
What I'm trying to do is show changes to my health(and mana) on the same line every time I either receive or recover damage. So, say if I get hit, I want my scroll to go something like this:
556hp - 732mn --
Damn, got hit
356hp - 732mn -- (Took 200 damage)
I've been playing around with this for a while, and got somewhere by doing:
Pattern:
Value:
Code: |
#MATH damage @curhp-%1
#say Took @damage
curhp=%1
curmn=%2 |
But this has two major faults. For one, it outputs the #say onto the next line, which, in my case, is unacceptable, and secondly, and probably most importantly, it waits for the -second- time I see the prompt to output it, not as soon as the prompt line shows up, which doesn't work for me despite it coming up with the correct number.
Any and all help would be very greatly appreciated, thanks in advance. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 09, 2008 2:56 pm |
In CMUD, you can use #sayadd - in zMUD it's a bit more difficult. You'll need to put brackets around the whole pattern, then do this:
#trig {(pattern)} {#sub {%concat(%1,"Damage: ",%eval(@curhp-%2)}}
or something. All the other %nn variables in your script will need to go up by 1.
I'm not sure what you're asking about with it coming up on the second prompt. It clearly can't know how much damage you've taken until the prompt after you took the damage. More info would help. |
|
|
|
Daarte Beginner
Joined: 09 Jul 2008 Posts: 10
|
Posted: Wed Jul 09, 2008 3:22 pm |
Hm, I'll try that out, thank you.
And as for the prompt thing, you're right, let me explain clearer. This is what happens:
556hp - 732mn --
Damn, got hit
356hp - 732mn --
[ENTER, OR ANYTHING TO SHOW THE PROMPT AGAIN]
356hp - 732mn --
Took 200 damage
Edit: Alright, I tried the above method and after a few changes, it looks presentable and works (minus the fact that I still have to wait for the second prompt after the hit to see the damage in the prompt above it), thank you. However, just out of simple curiosity, I was wondering if anyone had any other takes on this, as there are probably a ton of ways to work this out. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 09, 2008 4:11 pm |
That's probably due to the way your MUD terminates prompts. See also this thread. It's for CMUD, but it still applies.
|
|
|
|
Daarte Beginner
Joined: 09 Jul 2008 Posts: 10
|
Posted: Wed Jul 09, 2008 4:19 pm |
Ah, brilliant! That helps more than anything ever, thanks.
|
|
|
|
|
|
|
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
|
|