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
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Sun May 22, 2005 11:18 am   

#walk and the mapper code question
 
Hey. Ive been trying to write this for a long time.. and seem to be getting nowhere.... I wonder if anyone could help!

I have all of the world mapped and what I would like to do is walk to a room from a certain trigger. so for example

Quote:
An image of a big bannan at home of talgren appears before you


What I would like the mapper to do is to see the location and #walk there or whatever function is needed.

If the mapper has multiplue entries.. for example the location 'field'... it should (on activation of an alias) walk each location in turn.

thankyou for taking your time to read this
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Sun May 22, 2005 11:45 pm   
 
#walk <vnum of room you want to walk to>
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Mon May 23, 2005 12:03 am   
 
I think he is wanting to do a #MAPQUERRY on "home of talgren" (assuming that's the room name) then walk to each found ObjID. Then if "a big bannan" isn't there #walk to the next found room.

Doing the homework on it now... unless someone beats me to a script for it :P
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Mon May 23, 2005 12:41 am   
 
Assuming the output of the mud is alwasys similar "An image of (mobname?) at (roomname?) appears before you", the following might help ya.


#TRIGGER {An image of (*) at (*) appears before you} {found_rooms = %MAPQUERY([Name] LIKE '%@room2find%')}

this will leave you with "#SHOW @found_rooms" looking something like 123|456|789

#FORALL @found_rooms {#SHOW %walk(%i)}

would show:
.2s3w4n
.2s3w4new
.2s3w4ne2ws

speedwalks are example only. Dunno what you want todo besides goto each of them, but instead of #SHOW you could use additem and put the outputted speedwalks into another variable and loop walk through them. The speedwalks returned are path from room where the FORALL is ran, i did it from recall, so to go to each and repeat... i did:

#FORALL @found_rooms {recall;#WALK %i;#WAIT 2000;#show Made it to room #%i}

just replace "#WAIT 2000;#show Made it to room #%i" with what you want it to do, or remove if you just wanna walk to all the rooms.
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Mon May 23, 2005 4:14 pm   close.. very close.
 
hey.. that was fantastic... exactly what I wanted. small problem now...

Some times it works and sometimes it doesnt....

this is my code

Code:
@locating = %1
@room2find = %2
found_rooms = %MAPQUERY( Name LIKE '%@room2find%')


An image of Xolani at Springdale square appears before you.

Returns
@locating = xolani
@room2find = Springdale square
@found_rooms = 442 (the number of the room)

Which is fantastic, exactly what I wanted

however... the following returns nothing

An image of Some fine purple sand at On the top of a forest hill appears
before you.

none of the variables are completed..

now I tried

#say An image of Some fine purple sand at On the top of a forest hill appears before you.

This returned the correct values.

This was the same with a number of other triggers.... so this means the trigger isnt picking it up correctly right? any ideas...
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Mon May 23, 2005 4:16 pm   
 
update.. ive found the problem but not a fix....

using the trigger An image of (*) at (*) appears*

so it all appears on one line seems to work... so its a wrapping problem?

any idea for those long triggers that go onto two lines....
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Mon May 23, 2005 4:23 pm   
 
second problem is that some of the triggers have punctuation in...


An image of Me at Forest of G'harran appears before you. ... doesnt work

but


An image of Arturo at Forest of Gharran appears before you. .... does
Reply with quote
Istroath
Novice


Joined: 11 Feb 2005
Posts: 39

PostPosted: Tue May 24, 2005 5:46 pm   
 
try this useing the (*) in your trigger and then "%1" the " tell zmud that all inside "" is the info you want to store and it well then shed the "" off

@locating = "%1"
@room2find = "%2"
found_rooms = %MAPQUERY( Name LIKE '%@room2find%')
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Tue May 24, 2005 6:05 pm   
 
The first issue is line wrapping... not much you can do but shorten the expression or increase where it wraps (mud setting)

Trigger:
^An image of (*) at (*) appears

Second problem solution (about the non-alpha characters messing things up) is to remove them before the search

@locating = "%1"
@room2find = %subregex("%2","[^\w\s]","")
found_rooms = %MAPQUERY( Name LIKE '%@room2find%')
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Tue May 24, 2005 6:22 pm   
 
thanks for that very much appreciate it

small problem with removing the punctuation tho... problem is this also means all the punctuation needs to be removed from every room on my map.. is there a way to batch do this rather then by hand

I shortened the expression and increased wrapping.. it worked but its not the way I'd like to do it. sure theres no way to get around it? as increasing the wrapping isnt perfect for me
Reply with quote
Maelstrom
Apprentice


Joined: 10 Feb 2005
Posts: 158

PostPosted: Tue May 24, 2005 8:50 pm   
 
This should be taken with a grain of salt as, while this is technically correct regex wise, I dont know if this is supported...
I guess only testing will tell.

Try changing the expression to a regex (one of the trigger options) and use this:
^An image of (.*) at (.*) appears(?s:.*\.$)

This *should* be a multiline embedded regex but I dont have time to test to see if it works as intended.
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Wed May 25, 2005 11:40 am   
 
use:

room2find = %replace( %1, ', %)

turns the ' into % (% is wildcard in mapquery... like * for trigger patterns)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu May 26, 2005 2:18 am   
 
room2find=%replace("%1","'","''")

Is actually what you want, Its always better to enclose in quotes to escape comas etc.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Thu May 26, 2005 1:05 pm   
 
cant make out which are single and which are double quotes... but nonetheless... it NEEDS to be %, the wildcard character for %mapquery...

%1 = Jake's Room <-- %mapquery doesn't like single quotes.
room2find = %replace( %1, ', %) <-- room2find now = Jake%s Room
%MAPQUERY( Name LIKE '%@room2find%') <-- executes: %MAPQUERY( Name LIKE '%Jake%s Room%')

commas, #'s $'s *'s etc dont seem to bother it... only single quotes

your %replace nexela from what i can see says to replace all " with '

commas, pipes, brackets, braces, empty spaces, and spaces are the only times i use " " around things to replace.
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: Thu May 26, 2005 8:50 pm   
 
this is all excellent stuff everyone!

the help with this has been amazing! thankyou!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sat May 28, 2005 2:55 am   
 
its %replace("%1", " ' ", " ' ' ") To use a single quote you need two of em % in sql is just like * in zmud, you can use % but then you could also return some matches that are not what you need.
_________________
Zmud Support Library
Zmud Knowledge Base
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