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
Yoho
Newbie


Joined: 18 Dec 2001
Posts: 5

PostPosted: Mon Jan 28, 2002 10:50 pm   

where checker
 
how would i make a script that would take the names and locations of the players when i type where, and place them into a list then show me the list in the status window? I'm a newbie to zmud and can't even figure out how to get a trigger to put the names into a list. below is an example of what is show when you type where. Thanks for any help :)



Players in your vicinity:
-------------------------
[Ragnarok ] - Ragnarok's Chateau upon the Plateau
[Gau ] - Lurking about
[Vordak ] - Lurking about
[Tharghan ] - A Beautiful Waterfall
[Reiflin ] - The Post Office of Trellor
[Lencil ] - Library of Trellor
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jan 28, 2002 11:24 pm   
 
#TRIGGER {^Players in your vicinity:$} {#VAR playersNear "";#T+ getPlayers}
#TRIGGER {~[(%w)%s~] - (*)} {#VAR playersNear %concat(%cr, %1, " - ", %2)} "getPlayers"
#TRIGGER {^$} {#T- getPlayers} "getPlayers"
#STW {Players near you:%cr@playersNear}

Enter these commands, one by one, in the command line to set the script up. Read the help file for each of the commands and functions used here as well as the Introduction to Triggers section to understand what is happening here.

Basically, we create three triggers. The first one will look for when the output of the where command begins, resets a variable, and enables a class which contains the other triggers.

The second triggers catches the name of the player and where he/she is. It then appends this info to a variable that will contain, at the end, the name and location of every player near you, in a formatted way.

The third trigger matches on a blank line. I suspect that this is how you know the output from where is done - because there is a blank line after the last player near you. It then disables the class with the last two triggers.

The #STW command just sets your status window to what it should display. Since it contains a variable, the status window will be updated each time the value of this variable is changed.

Kjata
Reply with quote
Yoho
Newbie


Joined: 18 Dec 2001
Posts: 5

PostPosted: Tue Jan 29, 2002 12:13 am   
 
For some reason only the last person shown on the where list is put into the variable
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jan 29, 2002 12:17 am   
 
Oops, I forgot something. Change:
%concat(%cr, %1, " - ", %2)

to:
%concat(@playersNear, %cr, %1, " - ", %2)

Kjata
Reply with quote
Yoho
Newbie


Joined: 18 Dec 2001
Posts: 5

PostPosted: Tue Jan 29, 2002 12:31 am   
 
Thanks :)
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