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
fireangel37
Beginner


Joined: 09 Jan 2004
Posts: 17

PostPosted: Fri Jan 09, 2004 8:46 pm   

String lists and the status window
 
Okay, I'm working with a string list called "people" which I am using to hold the names of all PCs and NPCs in a room. I'd like to be able to display this data on my status window. The variable contains:

Praetorian Elite Axeman|Praetorian Elite Halberdier|Praetorian Elite Halberdier|Praetorian Elite Swordsman|Praetorian Elite Axeman

#forall @people {#show %ansi(hi,red)%i%cr} gives me exactly what I want:

Praetorian Elite Axeman
Praetorian Elite Halberdier
Praetorian Elite Halberdier
Praetorian Elite Swordsman
Praetorian Elite Axeman


However, putting this into the status window (as I'm sure you know) ends up with something garbled since the status window doesn't print well. My work around is using the following:

%ansi( hi, red) @people.1
%ansi( hi, red) @people.2
%ansi( hi, red) @people.3
%ansi( hi, red) @people.4
%ansi( hi, red) @people.5

Unfortunately, this is limited in scope. Am I missing something or is the status window just not able to handle what I want?
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Jan 09, 2004 9:29 pm   
 
#loop 1,%numitems(@people) {#addi new " %ansi(hi,red)%item(@people,%i)"}
#stw {%replace(@new,"|","")}

this was a simple fix I made for you and deminstrates the popwer of the status window.

Oh don't forget to add this to you trigger: new=""
you have to clear it everytime I also cleared the @people the same way.
Reply with quote
fireangel37
Beginner


Joined: 09 Jan 2004
Posts: 17

PostPosted: Fri Jan 09, 2004 10:02 pm   
 
Thanks, that certainly gives me something powerful to work with. I'm already seeing the usefulness of %replace. If I want to, for instance, make sure I have one name to a line, what change would that require? I know doing #stw {%replace(@new,"|","%cr")} is useless (it just prints %cr after each entry).
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Jan 09, 2004 10:19 pm   
 
You could simply resize the window so it looked like they where on seperate lines.

In the example I gave it should alrready put each item of the variable on a new line
Reply with quote
fireangel37
Beginner


Joined: 09 Jan 2004
Posts: 17

PostPosted: Fri Jan 09, 2004 10:30 pm   
 
Ah, I figured it out. The addition of a %cr to the #loop 1,%numitems(@people) {#addi new " %ansi(hi,red)%item(@people,%i)"} function fixed it. Ie:

#loop 1,%numitems(@people) {#addi new " %ansi(hi,red)%item(@people,%i)%cr"}

Thanks again.
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