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


Joined: 22 Aug 2004
Posts: 32

PostPosted: Fri Jun 30, 2006 11:07 pm   

Step by step help
 
Code:
#TRIGGER {^(%w)(%s)~- (*)}
#VAR location %3


Trying to get something like

Ryuoni - Caemlyn Central Square

to capture the room name...works when I test it in the test part, but the variable only captures the first word of the room name in the mud. (there are also different amounts of space between the character name and the - )

Thanks ahead of time.

-R


Last edited by Reygar on Sat Jul 01, 2006 12:53 am; edited 1 time in total
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Sat Jul 01, 2006 12:00 am   
 
Code:
#TRIGGER {^(%w)(%s)~- (*)}
#VAR location {%3}


duh...sorry
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Sat Jul 01, 2006 12:58 am   
 
O.K. got that working and creating a list of rooms using

Code:
#TRIGGER {^(%w)(%s)~- (*)}
#ADDITEM location {%3}


now I need to extract the roomnumbers from the list using %mapquery I'm guessing. I have

Code:
#SHOW %mapquery("[Name] LIKE '???????'")


how do I extract the list of names from the variable and have it return the room numbers?
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Sat Jul 01, 2006 1:24 am   
 
Wow the search function is great...I have this now

Code:
#CLASS {Locate}
#VAR location {}
#TRIGGER {^(%w)(%s)~- (*)} {
  #ADDITEM location {%3}
  #SHOW %mapquery( {[Name] = '@location'})
  } "" {notrig}
#CLASS 0


problem is that it now only captures the first room name and gives me that number...how do I get it to provide all the room numbers?
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Sat Jul 01, 2006 2:27 pm   
 
Code:
#CLASS {Locate}
#VAR location {}
#TRIGGER {^(%w)(%s)~- (*)} {
  #VAR location %null
  #ADDITEM location {%3}
  #FORALL @location {#SHOW %mapquery( {[Name] = '%i'})}
  }
#CLASS 0


Is getting the job done...two things that need to be done are:

1. if more than one person is located in the same room, that room number is returned twice..only want it once.

2. have no idea what the command to highlight rooms using zmapper is (and the help file isn't helping)

Any help appreciated.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Jul 03, 2006 3:04 am   
 
Code:

#CLASS {Locate}
#VAR location {}
#TRIGGER {^(%w)(%s)~- (*)} {
  #VAR location %null
  #ADDITEM location {%3}
  #ALARM locatemapquerryalarm +5 {#FORALL @location {#SHOW %mapquery( {[Name] = '%i'})} }
  }
#CLASS 0


Try that. It will overwrite the alarm till you are done.

To highlight the room you can use %roomcol([vNum], [color])
I'd make a string list of vNum's you highlight so you can undo it later.
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Mon Jul 03, 2006 5:59 am   
 
Backtracking

Code:
#CLASS {Locate}
#VAR locations {} {}
#TRIGGER {^(%w)(%s)~- (*)} {
  #ADDITEM locations {%3}
  #FORALL @locations {#SHOW %mapquery( {[Name] = '%i'})}
  #VAR locations %null
  }
#CLASS 0


with this input

Players in your Zone
--------------------
Inochi - Square of Tammaz
Bromax - Cozy Room
Falyn - Cozy Room


gives these results


19483|19484|19536|19540|19541|19542|19546|19547|22749
19483|19484|19536|19540|19541|19542|19546|19547|22749
19483|19484|19536|19540|19541|19542|19546|19547|22749
19499
19499

the numbers are correct, but why is the first set repeated three times?
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Wed Jul 05, 2006 11:14 pm   
 
SO CLOSE I CAN TASTE IT!

Code:
#CLASS {Locate}
#VAR locations {Seandar Central Square} {}
#TRIGGER {^(%w)(%s)~- (*)} {
  #VAR locations {%3}
  #PATHHIGH path {%mapquery( {[Name] = '@locations'})}
  } "" {notrig}
#CLASS 0


works 92.125% of the time....only trouble it has is when there is more than one room with the same name in the zone..it won't highlight any of them....anything I can do to fix that?

Thanks.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jul 06, 2006 3:31 am   
 
That almost sounds like standard behavior, except that it should be operating on first-found rather than "umm, I don't know which one you want so I'm not doing anything".

Perhaps add in room description or exits? My guess is that you'll want to narrow down your search field to eliminate this situation.
_________________
EDIT: I didn't like my old signature
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Thu Jul 06, 2006 5:41 am   
 
Can I limit the mapquery to the current zone using something like

AND [ZoneID] = %zonenum( )

in the mapquery....just not sure of the syntax


what I am going for is highlighting all possible rooms a person could be in....if they are in a room called "The Road" I want to see where ALL of those rooms are on my map.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jul 07, 2006 12:19 am   
 
should be able to. I don't know how to do it, either, though.
_________________
EDIT: I didn't like my old signature
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jul 07, 2006 3:29 pm   
 
Wow, you have got that working by pure chance. The syntax that you are using for #PATHHIGH is incorrect.

Try something like this instead:
Code:

#CLASS {Locate}
#TRIGGER {^%w%s~- (*)} {
  #FORALL %mapquery(%concat("[Name] = '", %1, "'")) {
    #NOOP %roomcol(%i, "red")
    }
  } "" {notrig}
#CLASS 0


#PATHHIGH was only working because it was highlighting the path from the room that you gave it to itself, since "path" is an invalid path string. When you gave it a stringlist of rooms, instead of just one, then it didn't accept that as a valid room number and did nothing.

What you need to do is to loop through the results of %mapquery and color each of those rooms. That's what the script above does. I eliminated the variable, since it isn't actually needed, and changed the way %mapquery was being called, to make it more compatible with the way strings are handled in CMUD.

Finally, as TonDiening mentioned, you could change the script to store the results of %mapquery in a variable, so that you may later loop through it and return all of the rooms to their original colors.
_________________
Kjata
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Fri Jul 07, 2006 11:01 pm   
 
Thanks..but a couple of things...first, that script does nothing to my map. Secondly about 90% of my map is color coded based on a system I have and I am VERY warry of changuing colors with a script like that. As far as #pathhigh goes...there may be a bug in it, but that bug is EXACTLY what I want...maybe I should request it for CMUD Wink

Code:
#pahthigh <any text> 646


highlights the room 646 on the map....starnge that if I take out the <anytext> part and just put

Code:
#pathhigh 646


nothing happens....and the text can be ANNYTHING...letters, punctuation, numbers etc.

I have zmapper also and I have been told that there is a way to highlight certain rooms using that, but havent been able to figure out how.


I also thought (using the #pathhigh "bug") that if I tried using #forall

Code:
#forall @locations {#PATHHIGH path {%mapquery( {Name = '%1'})}}


or something like that might work...anyway thanks for all the help with this...any more suggestions are welcome.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sat Jul 08, 2006 2:37 am   
 
Reygar wrote:
Thanks..but a couple of things...first, that script does nothing to my map. Secondly about 90% of my map is color coded based on a system I have and I am VERY warry of changuing colors with a script like that. As far as #pathhigh goes...there may be a bug in it, but that bug is EXACTLY what I want...maybe I should request it for CMUD Wink
Try this
#ALIAS test {#var location {};#forall @locations {#additem location {%walk( %i)}};#FORALL @location {#PATHHIGH %i}}
#VAR location {.9w6nw2nw|.4n3w|.10w2s4wn|.15w5nw3n2w}
#VAR locations {3133|3063|3108|2730}

I'm assuming of course that you already have a way of populating the locations var

_________________
http://www.Aardwolf.com

Last edited by Vitae on Sat Jul 08, 2006 3:12 am; edited 1 time in total
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sat Jul 08, 2006 3:08 am   
 
Reygar wrote:

works 92.125% of the time....only trouble it has is when there is more than one room with the same name in the zone..it won't highlight any of them....anything I can do to fix that?



#ALIAS test2 {#var location {};#var locations {};room_to_find = %replace( %0, ', %);#additem locations {%MAPQUERY( {Name LIKE '%@room_to_find%' AND ZONEID LIKE '%zonenum( )'})};#forall @locations {#additem location {%walk( %i)}};#FORALL @location {#PATHHIGH %i}}
#VAR location {} {}
#VAR locations {} {}
#VAR room_to_find {} {}



"test gemstone" searches the current zone for anything with gemstone in the room name (The Gemstone, Path outside the Gemstone, etc...) gives me 4 results and highlites the paths


#ALIAS test3 {#var location {};#var locations {};room_to_find = %replace( %0, ', %);#additem locations {%MAPQUERY( {Name LIKE '%@room_to_find%' AND ZONEID LIKE '%zonenum( )'})};#FORALL @locations {#PATHHIGH path %i}}
#VAR location {} {}
#VAR locations {} {}
#VAR room_to_find {} {}

which utilizes the bug (maybe it IS a nice bug after all) will highlite just the 4 rooms
_________________
http://www.Aardwolf.com
Reply with quote
Reygar
Novice


Joined: 22 Aug 2004
Posts: 32

PostPosted: Sat Jul 08, 2006 5:08 am   
 
Vitae....you are god.

Code:
#CLASS {Locate}
#TRIGGER {^(%w)(%s)~- (*)} {
  #VAR location {}
  #VAR locations {}
  room_to_find = %replace( %3, ', %)
  #ADDITEM locations {%MAPQUERY( {Name LIKE '%@room_to_find%' AND ZONEID LIKE '%zonenum( )'})}
  #FORALL @locations {#PATHHIGH path %i}
  #VAR location {} {}
  #VAR locations {} {}
  #VAR room_to_find {} {}
  }
#CLASS 0


set it up to fire off my trigger...thanks a million...off to my next project.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sat Jul 08, 2006 2:12 pm   
 
Me? god? heck no. I just took what you had, took what I use for my speedwalk script and merged them :-)
Took me an hour to figure it all out.
Thanks for the compliment tho. I might have a use for this myself.
_________________
http://www.Aardwolf.com
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