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 Goto page Previous  1, 2
Droid Posted: Sun Aug 31, 2003 3:46 pm
Zmud really usefull... just for programmers??
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Thu Mar 04, 2004 8:18 pm   
 
Also Mine looks like that because the one that also does zonematching dont work for me. Im using the one right before he started trying to match the zone. So I have the same problem when vnums from another area that has common room names as the room names in the zone im going to. Cause then they try going to vnums of rooms in another zone in my zone. After I get the room name to go for an exact match instead of Like which searches for way to many different rooms, I will try and add zone checking
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Thu Mar 04, 2004 10:07 pm   
 
#CALL %mapfilter(%concat("ZoneID = ",81))
#CALL %mapfilter(%concat("Name Like '%",%-1,"%'"))
#LOOP 1,%numrooms( ) {#SH %mapvnum( %i)}
#LOOP 1,%numrooms( ) {#ADDITEM salas {%mapvnum( %i)}}
#CALL %mapfilter("")


ok This is my alias which i have named findroom.
I thought that maybe mapfilters stack so I tried putting one then the other. but whatever the last mapfilter is, sets what is filtered. Both of those filters work seperately for me but whever I try to combine them using AND it doesnt work.

I dont think I know the correct way to combine the two with the AND statement however. This is probably the reason. Can somebody please combine the two mapfilters for me using the AND statement?

Thank You OOOOO soooo much
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Mar 05, 2004 5:24 am   
 
The purpose of using the %concat function was to allow placing %'s before and after a function or numbered parameter (such as %-1), while still having the function or parameter interpreted. It shouldn't be needed for the ZoneID equality. In fact, as long as the %'s before and after %-1 are quoted %concat shouldn't be needed at all.

I believe that any of these three should work. Pick the one you prefer, and test to make sure I'm right. If I'm wrong, try another one. If none of them work, I probably don't understand how to use AND with %mapfilter.
#CALL %mapfilter((ZoneID = 81) AND (Name Like '"%"%-1"%"'))
#CALL %mapfilter(ZoneID = 81 AND Name Like '~%%-1~%')
#CALL %mapfilter( %concat( "(ZoneID = ", 81, ") AND Name Like '%", %-1, "%')"))
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Fri Mar 05, 2004 8:19 am   
 
The top two send me the vnum -1 twice
The last one gives me vnums for tons of rooms and areas.

The two work alone but not combined with AND... stil...
Thanks for trying to help me though LightBulb. I really wanna get this to work but its fighting me.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Mar 06, 2004 11:47 am   
 
This one works for me fine:
#CALL %mapfilter(%concat("(ZoneID = 81) AND (Name Like %", %-1, "%)")
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Sun Mar 07, 2004 2:38 am   
 
I wonder what I have wrong Kjata. Cause that one dont work for me. When i use that as the mapfilter i get the vnum for every room in every area shown to me. Here is everything I have to do with the ones I have set up, they sorta work. but the problem I have is that when the findroom alias is used to gather vnums matching the room name searched. Vnums for all areas are gathered instead of just vnums for my quest area. So when it goes to my quest area, the mapper tries to goto the vnums for the incorrect zone that isnt even my quest area/zone.

I got all this by doing a text export so if you save the below code in notepad then open your settings and import text you can check it out. If anyone can tell me what I might be doing wrong, or what a working version of the AND statement with zone checking is please tell me.

With these all I do is request a quest. A couple variables are set with triggers then (make sure mapper is open) I hit the F3 key which is a macro set to do the findroom alias which searches for vnums of rooms that match the roomname I searched for. Then it uses the %walk function and goes to the vnums in the zone that my quest is in.

-------------Begin of code-------------

#CLASS {auto map|onwalk}
#ALIAS onwalkend {#if (questing 1) {#delnitem maproomvnums 1;#walk %item( @maproomvnums, 1) @questzone}}
#CLASS 0

#ALIAS findroom {#CALL %mapfilter(%concat("Name Like '%",%-1,"%'"));#LOOP 1,%numrooms( ) {#SH %mapvnum( %i)};#LOOP 1,%numrooms( ) {#ADDITEM

maproomvnums {%mapvnum( %i)}};#CALL %mapfilter("")} "auto map"
#VAR maproomname {The Pit} {_nodef} "auto map"
#VAR questzone {Hell} {_nodef} "auto map"
#VAR maproomvnums {} {_nodef} "auto map"
#VAR questing {0} {_nodef} "auto map"
#TRIGGER {Questman tells you 'of (*) which is in the general area'} {maproomname=%1} "auto map"
#TRIGGER {Questman tells you 'of (*).'} {questzone=%1} "auto map"
#TRIGGER {Questman tells you 'Congratulations (%w) on completing your quest!'} {questing=0} "auto map"
#KEY F3 {questing=1;findroom @maproomname;#T+ onwalkend;#wait 5000;#walk %item( @maproomvnums, 1) @questzone} "auto map"

-------------End of code-------------
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Sun Mar 07, 2004 2:45 am   
 
The questing variable is set so that onwalkend doesnt get used when im using the mapper not with that script, if it werent for that variable the mapper would walk you somewhere else soon as you finished using the mapper to goto a room if you werent on a quest and just usning the mapper for something else other than the script
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Sun Mar 07, 2004 4:09 am   
 
YAY! Thankx Kjata, your pattern worked except for one missing comma, after i added it everything is good

#CALL %mapfilter(%concat("(ZoneID = ,211) AND (Name Like %", %-1, "%)")

theres the mapfilter I use in the findroom alias now for zone checking. I just needed to use kjatas mapfilter with a comma before the zone number
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Sun Mar 07, 2004 4:14 am   
 
spoke too soon. I had two still had the old mapfilter that was just the room name with out the zone checking, below the one i thought worked, so it was overriding the maps filter. I will keep trying to figure it out though
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Sun Mar 07, 2004 4:40 am   
 
#CALL %mapfilter(%concat(Name = '@maproomname'))
#CALL %mapfilter(%concat(ZoneID = 211))

either of these filters work seperate for me also. The name filter here is better because it reduces the number of matches just from the exact room name checking instead of Like room name checking. Still working on a way to get these two combined. I am really confused why i am able to use them seperate but not together.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Mar 07, 2004 10:19 am   
 
I just punched this in the command line at it works perfectly.
#CALL %mapfilter("(Name LIKE '%road%') AND (ZoneID=15)")
I only had a minor problem with this:
#CALL %mapfilter("(Name = 'Velgosia way') AND (ZoneID=15)")
doing #CALL %mapfilter("") then retrying the second one got it working though. I always clear out the filter at the end of the script that made it so all my other scripts are not confused. It is just a good practise when affecting such a global control.
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Tue Mar 09, 2004 6:08 am   
 
ok I got it working with the below code:

#CALL %mapfilter(%concat(Name = '@maproomname' AND ZoneID = '@questzonenumber'))
#ECHO %mapfilter Rooms:%numrooms( )
#LOOP 1,%numrooms( ) {#ADDITEM maproomvnums {%mapvnum( %i)}}
#CALL %mapfilter("")

this works perfectly for me except for one thing... whenever a room name has a ' in it. those rooms that have the single quate thing use as an apostrophy to show possesion. Those rooms make it not work.

for example:

@maproomname=The Devil's Room
@questzonenumber=127

The apostrophy in Devil's throws off the mapper it does this when ever any room has one. None of the areas on my mud have apostrophys/single quotes. If the any areas did that would also be a problem prolly. How would I remedy this?
Reply with quote
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Wed Mar 10, 2004 8:28 am   
 
A question a bit on the side - I like how you use ZoneID in this script - I've got a script with similar functions, but since my map is all in one zone, there is no separate ZoneID. I was wondering - is it possible to put a specific zonename in the "User defined string" field of the room properties, and call it in a similar way to how you call ZoneID in the script above? What would the syntax be?
Reply with quote
Eowyn
Apprentice


Joined: 19 Jan 2001
Posts: 117
Location: Norway

PostPosted: Wed Mar 10, 2004 3:15 pm   
 
Nm - I found the %roomflags command - awesome feature!
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Wed Mar 10, 2004 6:58 pm   
 
Ok I have been testing different syntaxes and adding commas and quotes and all kinds of stuff but i really dont know what i am doing I finally figured this out:

If variable @maproomname=The Devil's Room were @maproomname=The Devil''s Room

notice the apostrophys are doubled there. There is no problem this way. Is there anyway I could do something like:
#if ' exists {replace ' with ''}

or something like that
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: Wed Mar 10, 2004 9:09 pm   
 
%replace( @maproomname, "'", "''")
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Thu Mar 11, 2004 9:21 am   
 
That did the job perfectly thanks. I am having some trouble with the onwalkend alias. It appears it only goes off after the first #walk. Then it wont go off again.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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