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


Joined: 03 Sep 2004
Posts: 23

PostPosted: Mon Sep 06, 2004 10:43 am   

Auto visit every mapped room? (revisited)
 
Well that's the problem. Great script however Zmud dumps when you try to use the alias a second time. Using a compaq 2500 laptop stock with XPsp2 Zmud 7.05

Script follows

#CLASS {WalkEverywhere}
#ALIAS WalkEverywhere {#VAR RoomsVisited %array( );#VAR RoomMap %array( );#VAR RoomCount 0;#VAR RoomVNum 0;#CALL %roommode(0);#SAY "Filtering map";#CALL %mapfilter("");#CALL %mapfilter(%concat("ZoneID = ",%zonenum()));#VAR RoomTotal {%numrooms};#IF (@RoomTotal<2) {#SAY "Not enough rooms!"} {#SAY {Creating arrays for @RoomTotal rooms};#VAR RoomMin %mapvnum( 1);#LOOP @RoomTotal {#VAR RoomVNum %mapvnum( %i);#CALL %arrset(RoomsVisited, %i, @RoomVNum);#IF (@RoomVNum<@RoomMin) {#VAR RoomMin @RoomVNum}};#LOOP @RoomTotal {#CALL %arrset(RoomMap,%arrget(RoomsVisited,%i)-@RoomMin,%i)};#SAY Walking;#VAR RoomCurrent %roomnum;onroomenter}}
#ALIAS onroomenter {#VAR RoomFNum %arrget( RoomMap, %roomnum-@RoomMin);#VAR RoomVNum {%arrget( RoomsVisited, @RoomFNum)};#IF (@RoomVNum) {#CALL %arrset(RoomsVisited,@RoomFNum,"");#ADD RoomCount 1};#IF (%roomnum==@RoomVNum) {WalkNext}}
#ALIAS WalkNext {#VAR RoomCurrent 0;#VAR RoomVnum {};#IF (@RoomCount < @RoomTotal) {#WHILE (!@RoomVNum) {#ADD RoomCurrent 1;#VAR RoomVNum {%arrget( RoomsVisited, @RoomCurrent)}};#WALK @RoomVNum} {#SAY All rooms visited}}
#VAR RoomsVisited {<Array>}
#VAR RoomCount {0}
#VAR RoomCurrent {0}
#VAR RoomMap {<Array>}
#VAR RoomMin {0}
#VAR RoomVNum {0}
#VAR RoomTotal {0}
#VAR RoomFNum {0}
#CLASS 0

(not my script mind you, it's from a previous posting)

If you could help that would be outstanding. Also it would be Perfect if I could conditionally stop. I don't need to restart but restarting would be a bonus.

Say I hit the room I am looking for (item or mob is there so I wanna stop and deal with it) Stop in the correct room (have had problems with mapper wanting to over run the room when you trigger on speedwalk) and execute alias based on trigger for why I stopped.

Resuming the script would be needed as well, but would also need a way to dump the rest afterwards as well, ie optional.

------------

In a nut shell, I run to a zone to check for a quest item. In walking around the zone, i see a rare object on the ground... ok I want that. Stop get item, then resume looking for quest.

Once I have found quest item, I don't want to remember this zone I want it to deal with the next zone so I can find the mob to give the object to. Again if i see I rare, stop and deal with it then resume.

Script should allow me to deal with aggressive mobs as well, by pausing the walk, letting me mount rescue in the correct direction to continue the walk.

While mounted, my alias MR executes a mount rescue followed by any command I want sooo

mr n will rescue go north. The game snatches my mount from the fight aswell so that's a bonus.
I could mr recall if I wish as well.

Tall Order I know but that would be a perfect script for my muds quest system. I have speedwalks setup to trigger on the quest announcement, it's just a matter of getting the object in item. I can do all the triggers for what forces a stop, it's just the resume and dump zone, and get it to quit crashing thing :D
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Tue Sep 07, 2004 10:59 am   
 
First, let's credit thargy since he wrote the script. Not that it's plagiarism, but it is polite.

Second, let's link the post you copied it from
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=17191
That way people can read the original if they need a reference.

Third, [removed by Falan ... got some rest and felt bad about the flame. Sorry for the attitude Embarassed ]
_________________
zMUD 7.05a

Last edited by Falan on Wed Sep 08, 2004 4:11 am; edited 1 time in total
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Tue Sep 07, 2004 9:51 pm   
 
First: Rude, yes save the flames...

Second: As for the link sorry forgot the link :P but did credit script as being a previous post, I in noway want credit for something I didn't write.

*******************************************************************************************
CENSORED FOR YOUR PROTECTION
*******************************************************************************************

Sixth: Zmud dumps even when all the Variables are reset/Unvar'd, I would consider that an issue somewhere in the client, the script may preform a third or fourth time if lucky, seems to depend on size of zone. Zmud crashing has corrupted my files, and I have reinstalled Zmud after this, it was a function in the script as loading nothing but this script will crash the client. The other crash also corrupted mudfiles.


*******************************************************************************************
CENSORED FOR YOUR PROTECTION
*******************************************************************************************


Last edited by dkotas on Thu Sep 09, 2004 12:03 pm; edited 1 time in total
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Sep 07, 2004 10:39 pm   
 
People please let's keep this civil. The is no need to be rude, that goes for both of you.

Now the script itself is likely dying a horrible death because of the use of arrays. Arrays are provided by way of an MS component with a COM interface. I believe the script just overloads the COM system, if not the component itself. Simply eliminate them and use zMud's built in lists. You can use #ADDITEM to initially build the lists, %item to access specific elements, and #DELITEM or #DELNITEM to remove completed elements.

As you have written over 200 triggers and 200 aliases I am sure you can figure out the needed modifications. I would also suggest adding an onroomenter alias that #DELITEMs rooms from the list. This will automate the process of paring down the list and also reduce how many times you visit some of the same rooms. Another method would be to random walk in the WalkNext alias by checking %roomlink's to see if they are in the list. If they are then visit one, if no room that you currently have an exit to is in your walk list then issue a #WALK to the first item of the list. This saves on both duplication of steps and processor time. Combining the 2 methods I describe should shorten your search greatly.

For stopping in a specific room you want to use slow-walking mode and generally need a trigger that fires after the roomname and before the prompt containing the #PAUSE command. If placement of such a trigger is not possible on your mud then you will have to provide specific room examples so we can try to find the right timing for the pause. The script could similarly be paused with a single variable, that stops WalkNext from preforming its action. Again a few more triggers and it should be doable.

Ideally you should develop a correctly functioning slow-walk system before have this script operate. The script makes use of the #WALK command which would automatically integrate it into your already functional slow-walking system. Another way to help this integration along would be to use the onwalkend alias to tell it when to preform WalkNext.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Tue Sep 07, 2004 10:56 pm   
 
Good idea, I can use the pathfrom command also to pick apart the nextspeedwalk to do the pausing I will step though the list with a check to see if @rare or @quest is 1 to pause and not lose my place, it would also get stored in a list as well, cycle that list, when done look at next room for it's path. Thargy was correct that the map tends to be built in the optimized order so I shouldn't need to do much reordering. I didn't know the arrays were that limited... I'll posted a correct script when I am done but it's late so expect it in 2 days as I am out of town 2morow.
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Wed Sep 08, 2004 5:12 am   
 
My apologies for the flame. It was still on my mind when I awoke today. Yeah, I'm a softy, and I felt bad about succumbing to such tawdriness. So, I edited my original post and then read the replies. I noticed the additional information you provided in your reply, dkotas. Not sure why you didn't provide it in the original entry. Would have saved so much trouble.

"Everyone else does it." Ack! Childhood flashbacks, "If everyone else jumped off a bridge would you do that too?"

Just to be clear, this is an apology, maybe a little constructive critism, and a bad attempt at playful humor. Razz

Again, I apologize for the previous post.
_________________
zMUD 7.05a
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Thu Sep 09, 2004 8:59 am   
 
Ok here's a painfully simple solution... Der :P, tho it wont stop and you can burn moves all you like

#CLASS {fastwalk}
#ALIAS buildfast {#call %mapfilter("");#CALL %mapfilter(%concat("ZoneID = ",%zonenum()));#LOOP %numrooms {#additem fastlist {%roomnum( %mapvnum( %i))}};#say done building list;#loop %numrooms {#sl (%pathfrom( %roomnum, @fastlist.%i));#if (%defined @fastlist.1) {} {#abort 1}}}
#CLASS 0

Basicly we kill any Map Filters, then refilter for current zone.
Then we make a list of rooms and store em (no preference for order other than order Mapped)
Next we just scroll right on through that sucker, dump the first element and execute the slowwalk.
We Abort when the first element is Null

Works it's fast and no issues I am aware of, have not tested extensivly but the logic is sound... if not efficent (lots of repeat visits to each room if you didn't map in a logical order). I think we can devise a better method.

Very fast execution.

The Next is a Monster... editing script for speed, already found a hugh change for speed so editing post to clean and repost in a couple minutes. Or perhaps I will be overcome by events and wait a couple hours :D

Well here it is:

#CLASS {WalkZone}
#ALIAS checkpath {#var best {};#var itterate {0};#var lowater {999};#var itterate {%numitems( @roomlist)};#if (itterate = 0) {#abort 1};#loop @itterate {#var testpath {%pathexpand( %pathfrom( %roomnum, @roomlist.%i))};countelements;#if ((@elements < @lowater) and (@elements > 0)) {#variable shortest {@elements};#variable best {@testpath};#if (@elements =1) {#abort}}}}
#ALIAS countelements {#var elements {%numitems( @testpath)}}
#ALIAS pwalk {#if (%1) {#var stop {0}} {walkzonevars};#while (@stop=0) {checkpath;move}}
#ALIAS walkzonevars {#call %mapfilter("");#var shortest 999;#var elements {};#var testpath {};#var best {};#delitem roomlist {%roomnum};#var itterate {0};#var roomlist {};#variable stop {0};buildlist}
#ALIAS buildlist {#CALL %mapfilter(%concat("ZoneID = ",%zonenum()));#LOOP %numrooms {#additem roomlist {%roomnum( %mapvnum( %i))}};#say done building list;#var itterate %numrooms}
#ALIAS move {#variable walkpath {%pathcompress( @best)};#if (@itterate <> 0) {#sl @walkpath} {#var stop {1}};#delitem roomlist {%roomnum}}
#ALIAS halt {#Pause;#var stop 1}
#ALIAS onroomenter {#delitem roomlist {%roomnum}}
#TRIGGER {Your STOP trigger HERE, I would enable it also to maximize it's usefulness} {halt} "" {disable}
#CLASS 0

lil choppy, and it doesn't look as if it is being optimal but the code forces closes room, think its just how the mapper jumps a bit, HUGE improvement, with %numberitem killed alot wasted processing with #forall counting....

Doesn't run *smooth* that is it does a couple really fast no problem, then slows up a bit, then back to fast, think I is due to my map... Smaller zones are 10x quicker Large is a bit slow at first tho it speeds up very quickly. All in all I am not totally displease, I think I may do a compiled version to improve the speed. Tho it is still ALOT slower than a single path that's optimized manually... Go figure the one that doesn't require as much processing, and has less steps works faster... At anyrate pick it appart, ask questions, make suggestions whatever... Hold the Charcoal.

Heavy Testing shows the same issue with pointers... Looks like it's online issue as offline version has no problems. I see the problem as being the Mapper itself, if anyone can replicate the problem and tell me if I am crazy.
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Sep 10, 2004 3:45 pm   
 
Tried the fastwalk. Reults on a 20 room area:
Quote:
done building list
Slow walking aborted

Didnt even budge.

Tried WalkZone as well.....what heck do i do to get it to do anything except make entries into my settings? All it did was leave my pointer as the hourglass for about 20 minutes.

As for the WalkEverywhere, the 20 rooms get walked thru fine, but tried it on a 173 room and it got PART of it right. Would be better if it slow walked or something cause when i ran into a locked door it screwed up.
Reply with quote
thargy
Beginner


Joined: 10 Aug 2004
Posts: 20
Location: UK, Uganda

PostPosted: Wed Sep 15, 2004 6:36 pm   
 
In my defence I wrote the original script in about an hour at 3 o'clock in the morning cause I was bored...

Just so you don't think that was my best effort.

Sad
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Sep 17, 2004 1:00 pm   
 
Oh it wasn't a critizicsm....criticizim...oh it wasn't a bad job :-)
It was just the locked door that screwed it up.
I'll assume that a trigger of some sort to show a locked door and an #abort.
That's the reaso for the #slow being needed i think. Cause it just sends everything in a mass of spam :-)
_________________
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Thu Sep 23, 2004 6:40 am   Correct solution
 
As for the problem with the first easy script I am at a loss as to why your not moving, again the logic is very simple, we grab a list of rooms filtered for current zone, then we sl walk though each of the items on the list, and then loop until no more rooms on list, we abort if the first element is null...

You should have a var called fastlist if you don't get that, then your problem is with the filter, perhaps you don't have a room selected in the map?

Executes flawlessly on my PC, made a clean script with only the fast version in it, executed 130 room seriously unoptimized map (291 moves required to execute the map) in 1.264 seconds (off line; online version speeds ofcourse will be dramaticly slower).

As for the monster, I am not suprised at all you spent 20 minutes with it, depending on how fast your PC is you will spend quite a bit of time, lots of recursion there however you should have moved, and the larger the map ofcourse the more you have to recurse. Same script executes in 4.214 seconds on my map with 261 moves (not a big change for optimizing as you can see) You should have seen how slow it was when before I put the one room move break in it. I posted this version simply to show how it can work, and pointed out there were several serious flaws in it, mostly relating to speed. The memory allocation problem with the mapper also is an issue which resurfaced underheavy testing. It's as I said I am not totally displeased, it does work even if painful, but I wouldn't recommend using it.

Again the fastest possible solution is to manually construct your own path. You will take a bit more time at it initially, however the payout is in execution speed. You will simply replay the path, you can deal with doors ect all along the way, and pause as you see fit. This is the method ultimately I have chosen to use. It's faster, you can chain the path to the dirs to the zone, and I have chosen to make a mother alias that executes each of the zones in order for the entire mud (well actually only the zones that are in my level range. It's very quick, it does pause for rares and quest mobs). I have also created a version of the same which will walk though a zone, look at all mobs (peek inventory (repeat look if !peek) and seal room and beep if mob has scavanged a rare. I enjoyed writting the script as it was an interesting exercise to make the code.

I am moving on a bit however, I am currently working on writing a mud server (100% from scratch, and with Zmud in mind from the get go, sofar I have the ability to connect, have a single zone of a whopping 125 rooms (generic room descs of only the room number, 3 moves in any direction till you hit the wall) and a total of 50 peiece of equipment (2 for each wear location) and you can "say". No combat built, no spells, no skills no nada, just a uberbasic mud, now for the fun part.... a bit under 78k worth of code, but it's coming along pretty well... I am skiming alot of discussions refrence what people want to see in a mud and plan to incorporate the better ideas. One issue I have always hated as an administrator was static variables (you should be able to modify alot of stuff as top level imm, to adjust balance of the game as it goes on..., you should also be able to track what cmds/spells/skills are used and see which are overstrength or worthless yada yada yada, sorry about the rant. If anyone has suggestions in what they would like for zmud friendly mud lmk with a private email. If not eh no problem. If anyone has any questions I would be more than happy to expand on my explination of the above code.

Again I appologize for forgetting the link to Thargy's previous posting. His solution works well however I get a zmud crash to to it, has anyone else experience this problem?

No warrenty expressed or implied. If you computer catches fire you promise not to sue me Wink
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Thu Sep 23, 2004 3:55 pm   
 
I'll assume by "the 1st easy script" u meant the FastWalk one.
Tried it again just now.
Have the 1st room of my clan hall set as currently there.
Made sure that it has the red lines around it.
typed in buildfast
Quote:
done building list
Slow walking aborted
Don't move anywhere. It's a 20 room map. Starting to think zmud hates me
_________________
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Thu Sep 23, 2004 3:57 pm   
 
did it create the variable list for you? Redlines, blue dot in the room? How many rooms in your map for clanhall?
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Sep 24, 2004 6:00 pm   
 
When u click on a room in the map it makes red lines around the square and lines to the next exits.
And when you set current position it puts a blue dot.
That's all set.
As i said, there are 20 rooms in the clan hall map.
And as far as I can tell there is no list being created.
_________________
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Sep 25, 2004 1:52 am   
 
Are all your preferences set to their default values? The most common cause of scripts failing to work for a specific person, when they work for everyone else, is a change to that specific person's Special Character preferences.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
thargy
Beginner


Joined: 10 Aug 2004
Posts: 20
Location: UK, Uganda

PostPosted: Sat Sep 25, 2004 5:04 pm   
 
At the moment I'm working on integrating my walk everywhere code into my run code, calculating the next room is actually relatively quick, so whilst running the small delay whilst deciding where to go next is better than a script. Couple of improvements that helped...

AVOID ARRAYS ;)

BTW Triggers can make wonderful state machines in manual cond mode. I have simple 11 state state machine for my run script that is pretty robust.

I really advise using a trigger as a state machine if you are doing any kind of complicated code, it seriously helps keep things more robust. My run machine happily copes with most situations. I might publish it eventually.

Was an interesting thread this one.
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Mon Sep 27, 2004 1:48 pm   
 
Never changed the special characters.
Never changed any of the default setting.
Well, except for the scroll back length.
_________________
Reply with quote
killunix
Beginner


Joined: 18 Nov 2007
Posts: 28

PostPosted: Mon Nov 02, 2009 3:40 pm   
 
why this script can't run on cmud pro? anyone can resolve and let it run on cmud,it's very very slowly on cmud
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