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
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sun Jan 02, 2005 10:25 am   

New Script Need help
 
What i'd like to do is to create a script that will inform my groupies of anyone in the area. I will accomplish this by issuing the command where and the following output is directly from the mud.

Players in your vicinity:
-------------------------
Whiteknight - A narrow trail through the deep, dark forest
Xarm - A narrow trail through the deep, dark forest
Peter - A narrow trail through the deep, dark forest


if these 3 people are NOT in my clanlist i want to gt and inform my group of thier presence and what room they are in.

The output would be almost identical as listed above for each person that is not in my clanlist.


Thanks in advance to all you supersmart people out there!
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sun Jan 02, 2005 1:54 pm   
 
use the %ismember function to check for them in your clanlist

whence it returns false on that check, gt the name and room.

Using #trigger and #cond will allow you to capture until it meets a unique line which distinguishes that the presence/scanning has ended.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sun Jan 02, 2005 5:58 pm   Continued...
 
Well the thought did cross my mind however i've been unable to get it to work. If you could help me actually write the script to do it that would be very helpful as i'm unable to figure it out.

Thanks!
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sun Jan 02, 2005 8:00 pm   
 
I've gotten it to work so far, but I need to know of a unique line that will be followed by that scan. Is there any or is it your prompt? Oh and btw, I've used "Loop pattern" as a condition type, but since it will not work with only 0 in param, I used 50 (meaning it'll only catch 50 ppl at tops...)

Anyway, I'm sure there are many refinements to the code I've done so far, but ... I'll post it anyway and if you have any unique lines that'd be great.

Code:
#VAR clanlist {Whiteknight|Google|Zugg|Peter}
#TRIGGER "ScanGT" {^Players in your vicinity:$} {}
#COND "ScanGT" {^(%w) - (*)$} {#if (%ismember( %1, @clanlist)) {} {gt Non-clannie! %trigger}} {looppat|param=50}

When you have the unique line to trigger on you can add that to the conditions list. Or make an entirely new trigger. Then make it do this: #set "ScanGT" 0 0

Hope that helps a bit.

I used this to test it with.
Code:
#echo Players in your vicinity:
#echo -------------------------
#echo Whiteknight - A narrow trail through the deep, dark forest
#echo Xarm - A narrow trail through the deep, dark forest
#echo Peter - A narrow trail through the deep, dark forest
#echo ....
#echo 123hp 123m 123mv >


And got the result:
Code:
Players in your vicinity:
-------------------------
Whiteknight - A narrow trail through the deep, dark forest
Xarm - A narrow trail through the deep, dark forest
gt Non-clannie! Xarm - A narrow trail through the deep, dark forest
Peter - A narrow trail through the deep, dark forest
....
123hp 123m 123mv >


Meaning it worked =) Hopefully it will do so for you.

You could make this aswell:

#trigger {(%*)} {#set "ScanGT" 0 0} "" {input}

That would set the scangt trigger-state to be set back to 0 whenever you make a command. A lil hack I know, but I couldn't get the cond-version of it all to work properly.
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Sun Jan 02, 2005 10:09 pm   Continued...
 
Well i think we are getting somewhere i've gotten this to work about 80% now. :) thanks!

I think the problem is that the trigger ^(%w) - (*)$ has a different amout of spaces between the users name and the room they are in and the trigger does not fire for everyone.

Below is a copy / paste from the screen output. You notice the different spaces here.

If i add spaces to the trigger like this..
Code:
^(%w)        - (*)$
it will yeild a different result than if like this ...
Code:
^(%w)              - (*)$

Code:

** not code but only way i can get it to display correctly**
Players in your vicinity:
-------------------------
Habit                - A cozy corner
Shamda               - The Albatross Tavern
Harlem               - The Meta Shop
Zedar                - The Albatross Tavern
Peter                - The Albatross Tavern
Blackrhom            - The Albatross Tavern
Crypt                - The Albatross Tavern
Manganash            - Chamber of Charity
Cho                  - The Albatross Tavern
Iddqd                - A cozy corner
Astaroth             - A cozy corner

As for the unique line ending the scan, the next line displayed is the prompt.
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Mon Jan 03, 2005 6:35 am   
 
Use %s after the (%w) to capture all the white space.
{^(%w)%s- (*)$}
_________________
zMUD 7.05a
Reply with quote
dcb
Novice


Joined: 02 Sep 2004
Posts: 42

PostPosted: Mon Jan 03, 2005 7:00 am   Continued...
 
Well this still did not solve the problem.
The trigger is not firing for everyone just some people.
When the trigger fires this is the output of what is happening.

Players in your vicinity:
-------------------------
Warehouse - A cozy corner
Chaszmyr - A grungy little alleyway
gt Chaszmyr - A grungy little alleyway
Amon - The Meta Shop
gt Amon - The Meta Shop
Duggal - The Albatross Tavern
gt Duggal - The Albatross Tavern
Spirit - Sativa Street
gt Spirit - Sativa Street
Mean - The Albatross Tavern
Avalios - Chamber of Current Events
Madcow - A cozy corner
Chrate - Chamber of Charity
Tarragon - Eas-o-matic's Weapon-o-rama
Fireball - The Meta Shop
Manganash - Chamber of Charity
Kaug - The Albatross Tavern
Eore - A cozy corner
Cho - The Albatross Tavern
Solon - The Albatross Tavern
Peter - A cozy corner
Ohm - A cozy corner
Xarm - A cozy corner
Terror - A cozy corner

I hope this helps.
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