|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Mar 30, 2002 8:12 am
Using #SAY in a trigger, before the linebreak |
quote:
My MUD has a simple bar to show current experience towards next level:
Experience: <|||||| >
This is pretty clear, but I'd like to have it in percentage as well. I tossed this together:
Trigger: ^Experience: <([|])%s>
Commands: #MATH temp ((%len(%1) * 100) / 50)
#SAYPROMPT " ("
#SAYPROMPT @temp
#SAY "%)"
But I can't get it to just add that to the end of the line -- it always puts it on a new line. If I uncheck the "Newline" option, it doesn't trigger at all.
Basically, I want to leave the MUD output the same, and just add my calculation on the end of that line. Any suggestions on how?
Use the #SUBSTITUTION command. It'll do exactly what you want:
#trigger {Experience:~<([~|])~>} {#SUB {Experience: ~<%1 @percent~%~>}}
li'l shmoe of Dragon's Gate MUD |
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Sun Mar 31, 2002 8:03 am |
quote:
But I can't get it to just add that to the end of the line -- it always puts it on a new line. If I uncheck the "Newline" option, it doesn't trigger at all.
If you uncheck the newline, make sure you
check prompt.
Ton Diening |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Apr 01, 2002 3:02 am |
quote:
#SUB will work, but the original text sent from the MUD has some nice colour coding to it that I'd prefer to keep if possible. #SUB nukes the colours, and making the trigger ANSI-aware complicates it enormously. It'd be preferable to just add my text at the end of the line.
I could use multiple triggers and classes (one to get the data, then match on the last ">" and use #SUB), or one of the beta's multi-state triggers, but I wanted to know if anyone knew of a simpler, more elegant solution. (One that didn't require the beta.)
Well, you didn't mention colors in your original post (remember, details are your friend). If you had mentioned that earlier, I would've done more than that little #SUB blurb.
First off, though, we'd need some details about the bar:
1)color of the bar
-- like this (one color that never changes)
||||||||||||||
-- like this (one color which changes based on value/length of bar)
||||||||||||| (for almost ready to level)
|||||| (for about halfway there, decided yellow was too hard to see)
|||| (for not even close to leveling)
--like this (several colors in a specific order)
|||||||||||||
2)values of the complete bar, as well as what one pipe is equal to (since we have no way of tracking the color of each bar).
li'l shmoe of Dragon's Gate MUD |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Apr 01, 2002 7:56 am |
quote:
I didn't originally mention the colours because I just wanted to add something to the end, not replace the bar.
The bar is 50 characters long (between the < >), so it seems reasonable to assume that each "|" stands for 2% towards your next level. The whole colour of the bar changes as it fills, although I'm not certain of the exact progression, I do know it it goes through grey, brown, yellow, orange, and red at some point. There are probably a few other colours in the mix too. The rest of the line's colours don't change.
Last time I tried an ANSI-aware trigger (around 5.50 or so), it was enormously complicated and difficult. Has it gotten easier?
Oh, and if the 'Newline' option isn't checked, the trigger doesn't fire, regardless of whether 'Prompt' is on or not. I don't know why.
First off, the prompt trigger won't fire because that line ends in a return character. Although the help file seems to suggest otherwise, trigger on prompt only applies when a line DOESN'T end in a return character (as most prompts appear).
I'm still working on the code, but it goes a bit something like this (the following does not work properly):
#MATH temp ((%len( %1) * 100) / 50)
#LOOP 1,%len( %1) {
#CASE %ismember( %i, "1|4|6|25") {@Expbar = %concat( @Expbar, %ansi( red))} {@Expbar = %concat( @Expbar, %ansi( green))} {Expbar = %concat( @Expbar, %ansi( blue))} {@Expbar = %concat( @Expbar, %ansi( yellow))}
Expbar = %concat( @Expbar, "|")
}
#SUBSTITUTE {Experience~: ~<@expbar ~(@temp~%~)~>}
Expbar = ""
Temp = ""
li'l shmoe of Dragon's Gate MUD |
|
|
|
|
|
|
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
|
|