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


Joined: 06 Mar 2008
Posts: 27

PostPosted: Mon Apr 14, 2008 4:28 pm   

%mapquery help plz
 
I've been trying to make a script to check my location matches the map and if not checks map for right room then teleports me to it

This trigger fires once after I move a direction, gets the room name on the map and mud and checks to see if they match(for some reason if I save it straight #VAR roomonmud I only get the first word saved to the variable thats why im using the array **Think I might be missing something simple there :) Cant use {%e[36m^(*)$} coz doesn't work with color trig for some reason**

#TRIGGER {%e[36m(*)} {
#VAR getroom %array( %1)
#WA 200
#VAR roomonmap %roomname( )
#VAR roomonmud {%arrget( getroom, 0)}
#IF (%begins( @roomonmap, @roomonmud)) {
#SHOW %ansi( bold, white)Room matches map!
} {
#VAR Path %mapquery( "[Name] LIKE '%road%'")
#FORALL @Path {#SHOW %roomname( %i)}
}
} "" {color}

The question ive got is, can I use a variable in the %mapuery somehow

#VAR Path %mapquery( "[Name] LIKE '%{@roomonmud}%'")

This is what im after but the variable doesn't expand

Thanks for any help
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Apr 14, 2008 6:45 pm   
 
Heh, there are already several pre-made packages for stuff like this but a short answer for your question would be this.

#alias roomlike {roomonmud=%concat( "[Name] LIKE '%", %replace( %-1, "'", "''"), "%'");#show %mapquery( @roomonmud)}

Then in the command line you would type "roomlike On a dirt road" to find the room named "On a dirt road"

If you wanted to find all rooms with the word road in them then you would type "roomlike road"

Hope that helps.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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