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 1, 2  Next
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Thu Oct 17, 2002 6:05 pm   

-On the Fly Speedwalking-
 
Ok..i would like players to be able to send me some kind of tell w/An area name and a room to jog to..
I would then #teleport myself to the first room in the area and execute some kind of #show %walk(*roomnumber*)
but I would like to be able to pull the roomnumber on the fly w/
#sh %walk(roomnum(Room Name)) ..unfortunatly..this doesnt seem to be working..and the documention isnt much help

Eventually this is going to be used in some kind of guidebot/Ie They pay me..i give them directions to point X if its mapped ;)

-W95
-Zmud 616
-A mapper of Erets-
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Thu Oct 17, 2002 7:00 pm   
 
I just realized that roomnum() works w/assigned shortnames
..Unfortuantly...thats not practical for my desired use..Any other ways of going about this?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Oct 17, 2002 10:29 pm   
 
You may leave blank the room number argument of any mapper function to signify the current room. Also, %roomnum(), without any arguments, returns the current room number.

However, this approach won't work with %walk because %walk returns the path between the room you are currently in and the room specified as an argument. What you could do then is to first save your current room number to a variable, #TELEPORT to the requested room, save the room number of this room to another variable, #TELEPORT back to the starting room (which you saved previosuly in a variable) and then do the %walk to the second room number that you saved.

Kjata
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Thu Oct 17, 2002 10:30 pm   
 
Its what i had in mind..however..that still avoids the question..How can i determine the vnum ;)..Is there some call into the Search function of the mapper i can tie into?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Oct 17, 2002 10:39 pm   
 
You determine the vnum by using the %roomnum function. If you use it without arguments, you get the vnum of the current room. If you first #TELEPORT to a room you want to find out the vnum and then use %roomnum without arguments it gives you the vnum of the current room, which in this case is the room that you wanted to know the vnum.

You can also do it by using the various mapper functions to search through the database until you find the room you want and then get the vnum of that room. However, this is a lot easier to do in the current beta versions that the public version. The #TELEPORT method is a lot easier for 6.16.

Kjata
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Thu Oct 17, 2002 10:45 pm   
 
-help file quote for #teleport-
Changes your location on the map to a specific location -- your MUD position is unchanged. You can specify either a room name (the short name of a room), or room number, and you can specify either a zone name or a zone number. If the zone is omitted, the current zone is assumed.

-EOF-
Um..you need a roomnumber or a shortname to use teleport ;)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Oct 17, 2002 11:19 pm   
 
Sorry, I though you were going to display the speedwalk path to the first room in a requested area. So, how are users going to request a room, by name? If so, how do you decide which room to use when more than one have the same name and are in the same area?

Seems like doing this will require looping through the rooms to find the want you want anyway. What you do is:
#LOOP %numrooms {#IF (%roomname(%mapvnum(%i)) = "%1") {This is the room we want - vnum is %mapvnum(%i)}}

Kjata
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Thu Oct 17, 2002 11:26 pm   
 
Well..They will be giving me a name ..yes ;)..Now..i dont get this..how do i use that loop line?--As to Multiple Results..It would be nice if it could return all of them..for me to somehow filter through and pick somehow (button perhaps)?-(most things with the same name are just long series of the same room..so in this case i'd give them the first result)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Thu Oct 17, 2002 11:55 pm   
 
Your problem has interested me. Due to limitation in the current version of zMud I can not get it to display paths from one zone to the next, but I can give a complete system that is up to displaying the path from what you have as the first room of the zone. I guessed on the tell format, and you may have to change that in the triggers.

So here you go:
#VAR CurrentCompare {} {}
#VAR CompareTarget {} {}
#TRIGGER {^(%w) tells you, '!path (*)'$} {#NOOP expected format is zone:room;TargetZone="";TargetRoom="";RoomMatches="";ClosestMatch=0;TargetZone=%trim(%word("%2",1,":"));TargetRoom=%trim(%word("%2",2,":"));#IF ((@TargetZone=%null)|(@TargetRoom=%null)) { tell %1 Your request was incomplete} { #IF (%zonenum(@TargetZone)=%null) { tell %1 I have no such zone on file. To request a zone list send a tell containing !zones.} {CurrentLocation=%concat(%zonenum()," ",%roomnum());#TELEPORT 1 %zonenum(@TargetZone);#LOOP %numrooms {CompareTarget=%concat(%roomname(%i),"|",%i);CompareNames};TargetRoom="";#FORALL @RoomMatches { #IF (%number(%word(%i,1,"="))=@ClosestMatch) {CurrentCompare=%word(%i,2,"=");#ADDITEM TargetRoom {%roomname(@CurrentCompare)};#SHOW %walk(@CurrentCompare)}};tell %1 I matched %numitems(@TargetRoom) room~(s~) they are %replace(@TargetRoom,"|",", ")~.;#TELEPORT %word(@CurrentLocation,2) %word(@CurrentLocation,1)}}}
#TRIGGER {^(%w) tells you, '!zones'$} {TargetZone="";#LOOP %numzones { #ADDITEM TargetZone {%zonename(%i)}};tell %1 Zones: %replace(@TargetZone,"|",", ")~.}
#CLASS 0

It does not send the path result to the person, I levea it up to you to build the purchasing system and figure just how to put together a path from a known place to the start of the zone.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 12:13 am   
 
Any way i can get !zones broken up?
-Attempted w/your example to no success-
Crell tells you, '!path Temple Square Old Zion'
--how would i get zones&rooms w/multiple words(or is that a cavat?
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 12:25 am   
 
-finds the syntax really really confusing..but your script is rather confusing so i cant even begin to rewrite it to something i can understand-..Can you post Example(s)
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 12:31 am   
 
-did some experimenting...the only thing it seems to want to match is the 1st room in a zone :|
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Oct 18, 2002 2:30 am   
 
The script uses a very fuzzy method of matching room names. That is to say the logic is such that it attempts to match partial names as well as full names. I am sure that is much of the confusing part.

The syntax is noted in the first #NOOP of the trigger.
#NOOP expected format is zone:room
Just guessing that would make your test eaxmple:
Crell tells you, '!path Old Zion:Temple Square'

As for the !zones trigger how do you mean broken up, I just tossed it in so people have a chance of interfacing with your script if you named the zone slightly different from what they might expect.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 5:50 am   
 
have you tried this?...everything i've tried w/this trigger matches what evr the first room in the specified zone is..it doesnt matter what i call the room..i can call the other room fred..and it doesnt have to exist...
..still the match found will be room 1 in the zone..
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 5:58 am   
 
Crell tells you, '!path Old Zion:Joro'

tell abc I matched 1 room(s) they are The Temple Of The Creator.

-Joro Does not exist..in any form :)-Did you somehow misplace something?
--Thanks for trying to help me with this seemingly difficult problem-
-As to splitting up !Zones
When you send that much text a time ..it thinks i'm spamming ;)--
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Oct 18, 2002 11:44 am   
 
Ahh, I see what happened. When I copied the class script to the forums it lost the alias that handles the comparison.

I am also providing the splitter you asked for. I also picked up on a situation where no room would really score a high match and covered that so the !path trigger is updated.

So lets try this again.
#CLASS {TellSplitter}
#ALIAS LongTell {#IF (%len(@Teller)>80) {TellCounter=2;#WHILE (@TellCounter<%numwords(@Teller)) {TellPart=%word(@Teller,1);#WHILE (%len(@TellPart)<80) {TellPart=%concat(@TellPart," ",%word(@Teller,@TellCounter));#ADD TellCounter 1};tell @TellPart}} { tell @Teller};}
#VAR Teller {} {}
#VAR TellCounter {0} {0}
#VAR TellPart {} {}
#CLASS 0

#CLASS {GuideBot}
#ALIAS CompareNames {CurrentCompare=0;#FORALL %replace(%item(@CompareTarget,1)," ","|") { #IF (%pos(%lower(%i),%lower(@TargetRoom))) {#ADD CurrentCompare 5}};#IF (%numwords(%item(@CompareTarget,1))=%numwords(@TargetRoom)) { #ADD CurrentCompare 10};#IF (%lower(%item(@CompareTarget,1))=%lower(@TargetRoom)) { #ADD CurrentCompare 100};#IF (@CurrentCompare>@ClosestMatch) {ClosestMatch=@CurrentCompare};#ADDITEM RoomMatches %concat(@CurrentCompare,"=",%item(@CompareTarget,2))}
#VAR CurrentCompare {0} {0}
#VAR CompareTarget {} {}
#VAR TargetZone {} {}
#VAR TargetRoom {} {}
#VAR RoomMatches {} {}
#VAR ClosestMatch {0} {0}
#VAR CurrentLocation {} {}
#TRIGGER {^(%w) tells you, '!path (*)'$} {#NOOP expected format is zone:room;TargetZone="";TargetRoom="";RoomMatches="";ClosestMatch=0;TargetZone=%trim( %word( "%2", 1, ":"));TargetRoom=%trim( %word( "%2", 2, ":"));#IF ((@TargetZone=%null)|(@TargetRoom=%null)) { tell %1 Your request was incomplete} { #IF (%zonenum( @TargetZone)=%null) { tell %1 I have no such zone on file. To request a zone list send a tell containing !zones.} {CurrentLocation=%concat( %zonenum( ), " ", %roomnum( ));#TELEPORT 1 %zonenum( @TargetZone);#LOOP %numrooms {CompareTarget=%concat( %roomname( %i), "|", %i);CompareNames};TargetRoom="";#IF (@ClosestMatch<15) { tell %1 I could not find any room that resembles the one you mentioned~.} {#FORALL @RoomMatches { #IF (%number( %word( %i, 1, "="))=@ClosestMatch) {CurrentCompare=%word( %i, 2, "=");#ADDITEM TargetRoom {%roomname( @CurrentCompare)};#SHOW %walk( @CurrentCompare)}};#VAR Teller {%1 I matched %numitems( @TargetRoom) room~(s~) they are %replace( @TargetRoom, "|", ", ")~.};LongTell};#TELEPORT %word( @CurrentLocation, 2) %word( @CurrentLocation, 1)}}}
#TRIGGER {^(%w) tells you, '!zones'$} {TargetZone="";#LOOP %numzones { #ADDITEM TargetZone {%zonename(%i)}};#VAR Teller {%1 Zones: %replace(@TargetZone,"|",", ")~.};LongTell}
#CLASS 0

That looks better.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 3:42 pm   
 
Working much better..Although it has problems w/rooms w/more then one name 'The Temple of The Creator
The Temple Square
etc
-Thanks again for your continued help ;)-
-Side note..when i get this working..Any objections to me publishing it on my site w/credits to you?
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 4:06 pm   
 
--I feel like a leech for asking..but..anyway You can get it to split the zones at the end of a zone name as opposed to a specific linelength..-Troll
-Den
Should come out Troll Den
:)...I'd also like to add a forbidden list -IE for the unopened zones or for zones I have stated will not be given out..-..
-TIA
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 4:21 pm   
 
-Well it returned the right amount of speedwalks for Crell tells you, '!path Kvuth's Cavern:Kvuth's Cavern'
--HOWEVER Results are----
.wwnnww
.wwnnw
.wwnn
.ww
.wwn
.wwnnwn
.wwnnwnn
.wwnnwnnn
--shortened list of results to give idea---
Final result still is

tell Crell I matched 1 room(s) they are Kvuth's Cavern.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 4:29 pm   
 
-Can you get it to ignore (PK) when matching..some of my zones were mapped before the PK flag was added ;)...
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Oct 18, 2002 11:10 pm   
 
First feel free to publish it and credit or don't credit me as you like.

The TellSplitter was written as a highly generic thing to break up any long tell you might toss at it. I could add logic to shift the break around for punctuation, but the processing overhead would not be worth the prettyness, if you want to do it feel free.

To add the forbidden list si,ply change this line in the !path trigger:
#IF (%zonenum( @TargetZone)=%null) {
to
#IF ((%zonenum( @TargetZone)=%null)|(%ismember(@TargetZone,@ForbiddenZones)) {
and populate the ForbiddenZones variable as type list.

I can not duplicate the problem you mentioned with it showing paths to every room, so I can only guess you made some changes to the script to cause that. The #SHOW line that displays that was there for debugging purposes and to help point you to where to put in code to assemble the full path and store it for the requesters purchase.

I have no idea what you mean about PK, you must explain how that is causing trouble more fully before I can help, or perhaps read the help files and figure out how the script is working so you can fix it.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 11:33 pm   
 
I did not modify your script..i even tried deleteing the class and recopying it..
---#sh Crell tells you, '!path Old Zion:Path of Gad'
tell Crell I matched 6 room(s) they are Path of Issachar, Path of Joseph, Path of Reuben,

tell Crell Path of Naphtali, A Mountain Path, Path of Judah.
---Path of Gad isnt even one of the results..yet all the speedwalks are right?---

---#sh Crell tells you, '!path Old Zion:The Temple Square'
tell Crell I matched 1 room(s) they are The Common Square.
---Explain that one ;).....--- 'It didnt get multiplematches..it just got the wrong match??'
---Cant see why this isnt working right--
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Fri Oct 18, 2002 11:45 pm   
 
-Well..i'm going to thank you all in advance for your help with this script and being patient w/a newbie like me whos only begining to undesrtand this script
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat Oct 19, 2002 12:11 am   
 
quote:

I did not modify your script..i even tried deleteing the class and recopying it..


I am glad cause I really don't support modified scripts. I am not omnipotent like Zugg.

quote:

---#sh Crell tells you, '!path Old Zion:Path of Gad'
tell Crell I matched 6 room(s) they are Path of Issachar, Path of Joseph, Path of Reuben,

tell Crell Path of Naphtali, A Mountain Path, Path of Judah.
---Path of Gad isnt even one of the results..yet all the speedwalks are right?---


Thoes results are to be expected, as I said it tries to match whatever the user inputs, and is designed to support the widest possible matching. In this case it picked up 6 rooms, the word "of" scored in 5 of the rooms, having the length equal to 3 words scored in all 6, and the word "path" scored in 6 of the rooms. The only room that confuses in those results is "A Mountain Path", but hey that could be what he is looking for, as I tried explaining it tries to overcome people being forgetful when there is no exact match.

quote:

---#sh Crell tells you, '!path Old Zion:The Temple Square'
tell Crell I matched 1 room(s) they are The Common Square.
---Explain that one ;).....--- 'It didnt get multiplematches..it just got the wrong match??'


Best I can say is that there is no room named "The Temple Square" and the closest match it can find is "The Common Square". Perhaps you can use the mappers built in find function to verify this.


On another not I did find one error in the !path trigger that should be corrected.
The line:
CompareTarget=%concat( %roomname( %i), "|", %i)
should be:
CompareTarget=%concat( %roomname(%mapvnum(%i)), "|", %mapvnum(%i))

This may be causing some problems but your results so far do not seem to indicate such, it might cause a room to never be examined for matching which might cause the second failure you mentioned.
Reply with quote
rwfrk
Wanderer


Joined: 26 Feb 2002
Posts: 81
Location: USA

PostPosted: Sat Oct 19, 2002 12:15 am   
 
--Ok..1stly..I know that room exists..I copied and pasted from the roomname in a room properties exactly---
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 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