|  | 
	
	
		| MaxiM Newbie
 
 
 Joined: 09 Feb 2005
 Posts: 4
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 1:44 am 
 Catching ang gaging prompt, moving it into status bar - how?
 
 |  
				| I know there's many topics on that already but none helped of them me. People just gave concrete exaples and kill me, i don't know how to modify them for my use. 
 As in the title, i want to gag my prompt and make it go into my status bar and/or gauge (preferably both). Not looking for anything fancy here, just something like this:
 
 100/100 HP 100/100 MP 100/100 AP
 
 If someone could just give me the basics so i can modify it later, i would be very greatful.
 |  | 
	
	  | 
		    
			  | 
 Last edited by MaxiM on Wed Feb 09, 2005 4:14 am; edited 1 time in total
 |   |  | 
	
		|  | 
	
		| Aarlot Adept
 
  
 Joined: 30 Dec 2003
 Posts: 226
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 2:24 am 
 |  
				| What does your prompt from the mud look like? 
 |  | 
	
	  | 
		    
			  | _________________ Everyone is entitled to their beliefs - until they die.  Then only the truth matters.
 |   |  | 
	
		|  | 
	
		| MaxiM Newbie
 
 
 Joined: 09 Feb 2005
 Posts: 4
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 4:12 am 
 |  
				| Stripped from all colors and ASCII it looks like this: 
 
 
 
	  | Code: |  
	  | %HP/%MHP HP %MA/%MMA MA %PA/%MPA PA |  
 And this is basicaly what i want to see in status bar, no need for pretty stuff
  |  | 
	
	  |  | 
	
		|  | 
	
		| nexela Wizard
 
  
 Joined: 15 Jan 2002
 Posts: 1644
 Location: USA
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 4:39 am 
 |  
				| The Simple Way 
 #TR "PromptTr" {(%d)/(%d) HP (%d)/(%d) MA (%d)/(%d) PA} {#ST {%trigger};#GAG} "" {prompt|nocr}
 |  | 
	
	  |  | 
	
		|  | 
	
		| MaxiM Newbie
 
 
 Joined: 09 Feb 2005
 Posts: 4
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 4:44 am 
 |  
				| OK, now i'm even more confused. I really tried to udrerstand, but i see totally different methods in every topic. I still don't know what's the scheme behind it, too many different versions. Could someone explain that to me?
 And thanks for quick response.
 I would also like to know if i can add colours to status bar and how to make gauges
  |  | 
	
	  |  | 
	
		|  | 
	
		| nexela Wizard
 
  
 Joined: 15 Jan 2002
 Posts: 1644
 Location: USA
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 8:22 am 
 |  
				| I SHOULD be sleeping :p 
 This script is meant to be pasted into the command line (where you do all your typing at).
 
 #TR
 this tells zmud that were making a trigger
 
 "promptTR"
 this is a unique ID for the trigger to prevent either overwrites or complete duplicates.
 
 {(%d)/(%d) HP (%d)/(%d) MA (%d)/(%d) PA}
 this is the trigger pattern to match on %d will match any number (%d) will match and save numbers
 
 {#ST {%trigger};#GAG} "" {prompt|nocr}
 these are the commands to run when it sees the pattern
 #ST {%trigger} takes the whole line that fired the trigger and moves it to the Status bar
 #GAG of course gags the line
 
 ""
 this is where the class name goes (I do believe)  a value of "" uses either the current default class or the root class //not sure which
 
 {prompt|nocr}
 this sets the options for the trigger
 prompt= fire this on a prompt line (no linebreak as in most "prompts")
 nocr=don't fire this when it contains a linebreak (prevents dbl firing with prompt option set)
 
 Zmud triggers in a nutshell :p Goo night
 |  | 
	
	  |  | 
	
		|  | 
	
		| mr_kent Enchanter
 
 
 Joined: 10 Oct 2000
 Posts: 698
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 8:26 am 
 |  
				| This is how I'd think it through. 
 If I'm trying to create a trigger for:
 100/100 HP 100/100 MP 100/100 AP
 
 I'd open the settings editor and create a new trigger.
 Then I'd copy and past the line I want to trigger on into the text box labeled pattern
 
 Next I'd anchor the pattern either with a ^ at the beginning or a $ at the end, or both.
 ^100/100 HP 100/100 MP 100/100 AP$
 
 Since the $ character represents a newline and most MUDs accept commands on the same line as the prompt and I'm triggering on the prompt, I'll only use the ^ at the beginning.
 
 Then I'd realize that the number portions of the line are likely to change and I might want to assign them to Variables. zMUD's triggers automatically create internal variables, I just need to check on the syntax for trigger wildcards and how to access variables in the help file.
 
 I could use the * character (a trigger-matching wildcard character); it will match most anything. Using just a * however, will only match the pattern, I won't be able to access the value unless I surround it with parenthesis. ( )
 
 Since I'm only wanting to match whole numbers though, I'd rather use a more specific trigger-matching wildcard. %d is a perfect choice. If I want to use the value of the whole number somewhere else though, I'll again have to surround it with parenthesis. (%d)
 
 Okay, being careful to preserve the spacing of my trigger pattern, I'll highlight only the parts that may change or that I want to use somewhere else (whole numbers), and type in (replace them with) the appropriate trigger-matching wildcard.
 
 ^(%d)/(%d) HP (%d)/(%d) MP (%d)/(%d) AP
 
 Okay, that should work for matching my prompt.
 
 Now, what do I want to do when I receive a prompt from the mud?
 
 I want to gag it, so in the value portion of the setting editor I'm going to put #GAG.
 
 If I want assign the first number to a variable named current_hp,
 I'll put #VAR current_hp %1 above the #GAG, so in the text box labeled value I now have:
 
 #VAR current_hp %1
 #GAG
 
 %1 in this case is an internal trigger variable that was created and assigned when zMUD saw the first (%d).
 
 %2 would be assigned to whatever the second wildcard enclosed in parenthesis matches. At this point I might have this in the value portion of my trigger:
 
 #VAR current _hp %1
 #VAR max _hp %2
 #VAR current _mp %3
 #VAR max _mp %4
 #VAR current _ap %5
 #VAR max _ap %6
 #GAG
 
 The #VAR commands will create/or reassign the values of the variables which can be accessed outside of this trigger.
 
 Now, I want to put those variables into my status line.
 
 #ST {HP: @current_hp ~/ @max_hp  MP: @current_mp ~/ @max_mp AP: @current_ap ~/ @max_ap}
 
 Or, if I just want to send whatever I matched to the status line, I could use the %trigger function:
 
 #ST {%trigger}
 
 In the trigger value, The Simple Way would look something like this...
 
 #ST {%trigger}
 #GAG
 
 or The Harder but more flexible WAY would look something like this...
 
 #VAR current _hp %1
 #VAR max _hp %2
 #VAR current _mp %3
 #VAR max _mp %4
 #VAR current _ap %5
 #VAR max _ap %6
 #ST {HP: @current_hp ~/ @max_hp  MP: @current_mp ~/ @max_mp AP: @current_ap ~/ @max_ap}
 #GAG
 
 Okay, I'm tired of this now. Hope this helps you understand a bit more.
 |  | 
	
	  |  | 
	
		|  | 
	
		| MaxiM Newbie
 
 
 Joined: 09 Feb 2005
 Posts: 4
 
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 10:24 pm 
 |  
				| Thanks, that actually helped me   One more thing tho - how to format status bar text? I want to make it bold/italic and maybe add a bit of colour. Is it possible?
 |  | 
	
	  |  | 
	
		|  | 
	
		| MattLofton GURU
 
 
 Joined: 23 Dec 2000
 Posts: 4834
 Location: USA
 
 | 
			
			  |  Posted: Wed Feb 09, 2005 10:37 pm 
 |  
				| Yes, very possible but you have to do it the long way with the 6 variables rather than the version using %trigger (unless you want to apply one format/color to the entire line).  What you do is to use %ansi() in front of every piece of information you want to format.  %ansi() will keep going until it hits another color/ansi-related code, so when you want to stop coloring/formatting use %ansi(default)  to revert back to normal format and coloration: 
 #STATUS {HP: %ansi(green,bold)@current_hp ~/ @max_hp%ansi(default) MP: %ansi(blue,italic)@current_mp ~/ @max_mp%ansi(default) AP: %ansi(yellow)@current_ap ~/ @max_ap%ansi(default)}
 |  | 
	
	  | 
		    
			  | _________________ EDIT: I didn't like my old signature
 |   |  | 
	
		|  | 
	
		|  | 
	
		|  |