Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
megaerik00
Newbie


Joined: 03 Jan 2016
Posts: 5

PostPosted: Mon Jan 04, 2016 2:02 pm   

Multiline variables
 
Hey folks, I was hoping someone could help me out with my latest project. I'd like my status bar to display all mobs in the rooms, and their current health levels. I got everything working just fine with 1 mob, but anymore than that, and it shuts down. The mud i play displays the mobs in a room on a separate line like so:

Nekeno has no apparent injuries.
Helarahi has no apparent injuries.
Luthien has no apparent injuries.


For the single target variation, i was using

(%a) has no apparent injuries being @nam

and each subsequent health description (bleeding heavily/torn to shreds/etc) as a separate variable, being @tar
so i could give it a numerical value that i can read easily, such as

@tar = is at 25%

This together resulted in:

Nekeno is at 25%, etc.

My problem is with the multiline. When i "scan" the mobs in the game, it returns with a newline for each mob. How might i incorporate a series of variables using multiline to end up with something like

Nekeno is at 25% Helarahi is at 40%

all on the same status bar line? Keep in mind that i am a complete novice when it comes to this stuff, it took me about 5 hours to get the status bar going in the first place. Thanks in advance.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jan 05, 2016 12:11 pm   
 
You didn't provide enough details for me to write it for you, but I can describe the general process. You use either an alias which turns on a class of triggers or a command input trigger with multiple states. The initial alias clears your variable, turns on the rest of the matching, and might turn off the status for speed. A trigger that matches your health report lines uses #ADDKEY to record the mob names and health values. A trigger that matches something after all the health lines turns off the health matching, formats the display variable, and does any other finishing.

The commands and functions you will likely want to look at in the help are #T+ #ONINPUT #ALARM #ADDKEY #LOOPDB %concat %replace
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
megaerik00
Newbie


Joined: 03 Jan 2016
Posts: 5

PostPosted: Wed Jan 06, 2016 7:30 am   
 
Thanks for the reply. So if i understand you correctly, in my initial alias, add a command to clear my target and health variables, and make sure a single class folder is open for my first target, set up a trigger to hit off of any of the health descriptons that deactivates the class folder for my 1st target, and activates a 2nd class folder that will add a variable for my 2nd target, and repeat for each additional target?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jan 06, 2016 1:24 pm   
 
Not quite. You would have a single trigger to capture things. The trigger is only active when you are expecting that type of information and turned off the rest of the time. The captured information is all added to a single variable. For example:
Code:
#ALIAS scan {#T+ TargetCapture;Targets="";#SEND {scan}}
#TRIGGER "TargetCapture" {^(%w) has ({no apparent|some modest|very severe}) injuries.$} {#ADDKEY Targets {%1} {%2}} "" {disable}
When capture is completed you disable the capture trigger with #T- and format the information in the Targets variable for display.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
megaerik00
Newbie


Joined: 03 Jan 2016
Posts: 5

PostPosted: Thu Jan 07, 2016 6:37 am   
 
Ah, gotcha. Thanks for the help, this looks like it will do the trick.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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