|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Tue Mar 08, 2016 4:30 pm
Zone Copy did something to rooms. |
I have a piece of code that is supposed to use "find" and locate my room on the map. This script wasn't created by me, so i'm not 100% sure how it works, though I understand most of it. However, the part i'm having issue with is that when using "find":
It's finding the roomname just fine, and if there is just 1 roomname, you "teleport" to it and it's good.
If there are multiple roomnames, it looks at the description for each room it finds and and tries to identify the room with the desc. However, this is the part that is not working. I know for sure that there is a room with the matching description, but it says that there are none and moves on.
After it doesn't find the room by desc, it goes off of the room exits with the roomname combination, It'll typically find one of those, but then it just picks the room with the lowest numerical roomnum, which is typically MILES off from where I'm located and it teleports me to that room rendering the script useless.
When I use it in "Verbose" mode.. ("find v") It walks me through what its doing on the script, and you can see that it never finds the room by the description. Particularly where the roomname is something common like "Main Street" or "Dock Road". It says.. well, this:
Main Street
The houses here are small and interspersed with shops, though everything seems
to be well kept. Even the road appears to have been recently repaired as the
the occasional patch of cobblestones appears rough and new contrasting with the
older stones which have been worn smooth. To the north is an intersection
and to the south are more shops. West is Morning Dew Drops Road according to
a shiny new street sign on the corner. A tailor's shop is to the east.
[ obvious exits: N E S W ]
Searching for room names...
Multiple matching room names found.
Searching through descriptions...
No matching room description found! Update your map.
Searching through exits...
Multiple matching room exits found!
Multiple possible matches, and your map is already in one of them. No action taken.
East: A hard-working tailor meticulously alters clothing here.
When I do a manual search, I can find that room just fine by using the first line of the description, just like the script is supposed to do.
So, here is the script: (Sorry it's so big.)
Code: |
#CLASS {Map Scripts|Find Room 2.2}
#ALIAS find {
#PRIORITY {
#VARIABLE FindRoomName {}
#VARIABLE FindRoomDesc {}
#VARIABLE FindRoomExits {}
#IF (%begins( %proper( %1), "V")) {
#SAY %crlf Find Room will now use VERBOSE mode.
#VARIABLE FindVerbose {2}
}
#IF (%begins( %proper( %1), "B")) {
#SAY %crlf Find Room will now use BRIEF mode.
#VARIABLE FindVerbose {1}
}
#IF (%begins( %proper( %1), "S")) {
#SAY %crlf Find Room will now use SILENT mode.
#VARIABLE FindVerbose {0}
}
#IF (%begins( %proper( %1), "M")) {
#SAY %crlf Find Room is currently in %item( "SILENT|BRIEF|VERBOSE", %eval( @findverbose+1)) mode.
#SAY %char( 32)Modes available: SILENT, BRIEF, VERBOSE.
}
#IF (%numparam( ) = 0) {
look
#IF (@findverbose) {#SAY Preparing to find this room on the map.}
#T+ FindRoomTrigger
#T+ FindRoomExitsTrigger
}
#NOOP
}
}
#FUNCTION frsubexits {%sort( %upper( %replace( %replace( %replace( %1, "[ obvious exits: ", ""), " ]", ""), " ", "|")))}
#VARIABLE FindRoomDesc {This is an inn favored by the merchants who come to Fal Dara. It is a quiet}
#VARIABLE FindRoomName {The Peaceful Knight''s Rest}
#VARIABLE RoomsFoundByName {38653}
#VARIABLE RoomsFoundByDesc {6113}
#VARIABLE FindRoomExits {S}
#VARIABLE RoomsFoundByExits {38354|38355|38356|38383}
#VARIABLE findverbose {1}
#REGEX "FindRoomTrigger" {(?:^|> )(\033.?.?36m(?!\a+ (?:speaks from the |answers your prayer)).*\033)} {
%literal( #PRIORITY {#VARIABLE FindRoomName {%trimleft( %right( %line, %pos( '> ', %line)))}})
#NOOP
} "" {notrig|color|disable}
#CONDITION {^(*)$} {
#IF (%line =~ "^*obvious exits: (*) ]$") {#VARIABLE FindRoomDesc {}} {#VARIABLE FindRoomDesc {%1}}
#STATE FindRoomTrigger 0
} {looplines|param=50|notrig|disable}
#TRIGGER "FindRoomExitsTrigger" {^*obvious exits: (*) ]$} {
#PRIORITY {
#VARIABLE FindRoomExits {%1}
#T- FindRoomTrigger
#IF (@findverbose=2) {#SAY}
#IF (%numitems( @FindRoomName) = 0) {
#IF (@findverbose) {
#SAY %char( 32)Failed to retrieve room info!
#COLOR red
}
} {
#IF (@findverbose=2) {
#SAY %char( 32)Searching for room names...
#COLOR darkgray
}
#VARIABLE FindRoomName {%replace( @FindRoomName, "'", "''")}
#VARIABLE RoomsFoundByName {%mapquery( NAME = '@FindRoomName')}
#IF (%numitems( @RoomsFoundByName) = 0) {
#IF (@findverbose) {
#SAY %crlf No matching room name found! Update your map.
#COLOR red
}
} {
#IF (%numitems( @RoomsFoundByName) = 1) {
#TELEPORT {@RoomsFoundByName}
#IF (@findverbose=2) {
#SAY %crlf Matching room name found! Correcting map position.
#COLOR green
} {
#IF (@findverbose=1) {
#SAY %crlf Matching room found! Correcting map position.
#COLOR green
}
}
} {
#IF (@findverbose=2) {
#SAY %char( 32)Multiple matching room names found.
#COLOR goldenrod
#SAY %char( 32)Searching through descriptions...
#COLOR darkgray
}
#IF (%numitems( @FindRoomDesc) = 0) {
#IF (@findverbose=2) {
#SAY %char( 32)Failed to retrieve room description!
#COLOR red
}
#VARIABLE RoomsFoundByDesc {@RoomsFoundByName}
} {
#VARIABLE RoomsFoundByDesc {}
#FORALL @RoomsFoundByName {#IF (%begins( %roomdesc( %i), @FindRoomDesc)) {#ADDITEM RoomsFoundByDesc %i}}
}
#IF (%numitems( @RoomsFoundByDesc)=1) {
#TELEPORT {@RoomsFoundByDesc}
#IF (@findverbose = 2) {
#SAY %crlf Matching room description found! Correcting map position.
#COLOR green
} {
#IF (@findverbose = 1) {
#SAY %crlf Matching room found! Correcting map position.
#COLOR green
}
}
} {
#IF (%numitems( @RoomsFoundByDesc)=0) {
#IF (@findverbose=2) {
#SAY %char( 32)No matching room description found! Update your map.
#COLOR red
}
#VARIABLE RoomsFoundByDesc {@RoomsFoundByName}
} {
#IF (@findverbose=2) {
#SAY %char( 32)Multiple matching descriptions found.
#COLOR goldenrod
}
}
#IF (@findverbose=2) {
#SAY %char( 32)Searching through exits...
#COLOR darkgray
}
#VARIABLE RoomsFoundByExits {}
#FORALL @RoomsFoundByDesc {#IF (@frsubexits(@FindRoomExits)=@frsubexits(%roomexit( %i))) {#ADDITEM RoomsFoundByExits %i}}
#IF (%numitems( @RoomsFoundByExits)=1) {
#TELEPORT {@RoomsFoundByExits}
#IF (@findverbose=2) {
#SAY %crlf Matching room exits found! Correcting map position.
#COLOR green
} {
#IF (@findverbose=1) {
#SAY %crlf Matching room found! Correcting map position.
#COLOR green
}
}
} {
#IF (%numitems( @RoomsFoundByExits)=0) {
#IF (@findverbose=2) {
#SAY %char( 32)No matching room exits found! Hidden doors suspected.
#COLOR goldenrod
}
#VARIABLE RoomsFoundByExits {@RoomsFoundByDesc}
}
#IF (%numitems( @RoomsFoundByExits)>1) {
#IF (@findverbose=2) {
#SAY %char( 32)Multiple matching room exits found!
#COLOR goldenrod
}
#VARIABLE RoomsFoundByExits {@RoomsFoundByDesc}
}
#IF (%ismember( %roomkey, @RoomsFoundByExits)) {
#IF (@findverbose) {
#SAY %crlf Multiple possible matches, and your map is already in one of them. No action taken.
#COLOR goldenrod
}
} {
#TELEPORT %item( @RoomsFoundByExits, 1)
#IF (@findverbose) {
#SAY %crlf Multiple possible matches! Randomly guessing map position...
#COLOR goldenrod
}
}
}
}
}
}
}
#IF (@findverbose) {#SAY}
}
#T- FindRoomExitsTrigger
} "" {notrig|disable}
#CLASS 0 |
I have modified colors, and taken out some of the "%crlf" in my version, but this is the raw uncut version. I don't believe the "%crlf" are pertinent. (maybe they are).
Looking at the script, it's showing that it finds the same 7 rooms by name/desc/exits. Even though when looking at each of those, only 1 actually matches name/description. So, it reads that it didn't find any rooms by description, but yet, the variable is showing that there are 7 rooms found.
What's very interesting is that by typing "find". I get the pretty printout showing me that it's looking for Rooms/Exits/Descs.. And sometimes it'll find it, and move me to a weird location based off of the exit, because it found many rooms by name, none by description, and then by "exits", it finds like those 7, so it just chooses the lowest roomnumber an teleports me there. BUT if, if type "#find", it finds the right location and I don't get any readout showing me that it's doing the searching or whatnot, even if I'm set to "Verbose". I have no idea why that is and it's super weird!
Is there anyone out there that would even understand or comprehend how to fix the issue? It seems like a sweet piece of code, but If it cannot distinguish between 2 rooms of like name by using a description, that will suck....
Anyways. If you need more details, let me know.
Thank you for your help. It's pretty intense and probably super time intensive but I do appreciate your time! (let me know if you need more roomnames or anything else to test).
You can also test it for real over at:
The Wheel of Time Mud. (WoTMud) Amazing game! |
|
Last edited by MisterDwooD on Mon Mar 14, 2016 4:59 pm; edited 1 time in total |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Tue Mar 08, 2016 9:38 pm |
I'm thinking it might be an issue with my map itself. I'll have to do some further testing.
After a bunch of testing, i'm still lost. But, I found that on some rooms, it does find the description helpful and finds it by that. But, other rooms it does not. I first thought it was cause there was punctuation in the first line of the room desc, like a "," or "'". But, I ruled that out by finding rooms that do it that don't have any punctuation in the first line. So now I'm lost again, and it's even more confusing because sometimes it works, sometimes it doesn't! So frustrating!
Is there any way to "refresh" the map database? I mean, like clean it up? I've done the "compact", but I'd like to do some maintenance on it.. maybe that's having adverse affects. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Wed Mar 09, 2016 4:02 am |
Your best bet to refresh it would be the map conversion tool, and run it both ways.
Or use a third party database tool, but I'm not sure if that would have any adverse affects. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Wed Mar 09, 2016 5:37 am |
Thanks for the reminder about the converter, I have heard about that before.
I'll go ahead and run some tests with it and see what I can find out.
Thanks. |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Mon Mar 14, 2016 1:09 am |
So after a bunch of testing and probing for WTF was going on, I found that it's only happening on a few select zones on my map. All other zones it's working just fine.
In these zones, it will tell me that it can't find the description, however, i can manually search for the room by description and it's finds it just fine. It's SUPER FRUSTRATING!
The script is meant to find a room by name, if there are lots by name, it looks for the description of the rooms and tries that way. But, since it's not finding description, is worthless in these zones. however, there IS a description on the map.
The zones it's happening on are the ones that I've copied from other maps, so that has to have something to do with it. It doesn't happen to those zones that were still on the map.
Also, using "find" which is the alias for the script isn't finding it.. BUT #find finds the room just fine! NOW WTF IS UP WITH THAT!
Anyways, I can provide the maps if anyone would like to compare or try it, but it's just extremely annoying.
Thanks! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Mar 14, 2016 2:33 am |
Have your script check against %zonename and use the appropriate #FIND method, accordingly?
Or rather, have you script do the faster method, with the slower method on backup if nothing happens.
Does a successful #FIND moving your #LOC #RAISE the onRoomEnter #EVENT? |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Mon Mar 14, 2016 6:54 am |
I'm not really sure what you mean... I have done some more testing, and I've found that any room that i created with my map is fine. Any room that was ported over using the "zone-copy" tool does not work.
That goes for copying zones to my map, then copying those rooms to one of my zones as well. So it's not just the zone, it's the actual room. I can create new rooms in a zone that was copied, and they're fine. But, I cannot move rooms from the copied zones to my zones with any success. So, for some reason those rooms weren't flagged the same when using zone copy. I have tested the map that the zones came from, and they worked just fine, so it's not the map either. It appears to be something that the zone copy utility is doing to the room when they're copied.
I have tried converting the copied map to cmud and then back, which also did not work.
It's not that it finds the wrong room, it's that it doesn't even register that there is a room with that description. That is with the script though. With the "#find", it does work well.
I think I'll incorporate the %zonename into the script, but I'd like to figure out what's going on. What I have reverted to doing is remapping the areas that I copied over. My map was pretty complete and there weren't tons of rooms that I brought over.
I looked at the raw database and i couldn't find ANY difference between a room that worked, and a room that didn't. So, that sucks.
But for now, I've narrowed the issue down to just the zonecopy program screwing it up.
Anyways. Thanks!
PS, I love those AMD Phenom IIs. I have the x6 1100T. It's been great! |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Mar 14, 2016 7:03 am |
Sounds like the database entry for those rooms is not matching up property somehow...
I assume remapping those areas is too much of a hassle?
My idea was for you to use a #FIND as well as a named alarm, that would do your custom find in say 10 seconds
if the standard #FIND did in fact: #RAISE onRoomEnter, on a successfull #FIND, you could define that event to stop the alarm from firing, as it would no longer be needed
Then since you have potentially automated both forms, you should be able to find yourself no matter what
#TR {some reason to need to find myself} {
#FIND
#ALARM "keepFinding" +10 {your custom find alias}
}
#EVENT onRoomEnter {#IF (%trigger("keepFinding")=1) {#T- keepFinding}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Mon Mar 14, 2016 8:08 am |
Boy was I wrong... there's about 15000 rooms I'd have to remap for it to be perfect again.. :( Man how I wish I knew what was wrong. The map is beautiful right now, just the find command isn't working right.. It blows my MIND how those are different. There has to be something that isn't transfering over in the code... Like, the zone copy tool is adding a space or something somewhere it shouldn't. :( MAN it's frustrating. I just remapped like 200 rooms.. I have to delete all the rooms, looking at a picture and remap, dismount a horse where appropriate, and then color code.. Takes forever!
Anyways. Just frustrated.
And if I'm actually fighting someone, that would take way too long to do. I have a good enough handle on where I am most the time, and at least if I can see the map, even if I can't find myself on it. Also, who stays in a room for 10 seconds!? haha
But there's no way i'm redoing 15000+ rooms...
Sad day that it didn't work the way i wanted. But, it's life.
Thanks for your time at least Shalimar! :) |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Mar 14, 2016 2:44 pm |
Well you can shorten the time delay, gotta start somewhere.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
MisterDwooD Novice
Joined: 04 Feb 2014 Posts: 42
|
Posted: Mon Mar 14, 2016 5:04 pm |
Well, If it actually "fixed" the room so that it was permanently fixed, I'd definitely go fix all my rooms using that, However, for some reason, it doesn't. So, I'll probably end up remapping a few zones, but until then, I'll just use #find instead of "find" in those zones because it tends to work for me.
:) Again, thanks! |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Mar 14, 2016 8:38 pm |
If you could do the following it might help. Stand in a room that does not work, make sure your map is correctly located to the same room. Run the find script with description checking. Go to the settings class script for "Find Room 2.2" and copy the line for the variable FindRoomDesc. Paste that in a code tag here. Then on the command line enter the following:
Code: |
FindRoomDesc=%roomdesc() |
Once again copy the class script entry for the variable and paste that into a code tag here. That will give us the best chance of determining what change was made during the zone copy and how to correct it.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
|
|
|
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
|
|