Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
njung
Newbie


Joined: 22 May 2018
Posts: 7

PostPosted: Thu May 24, 2018 6:12 pm   

Autowalk script with map
 
Hi all,

So I use a script to #walk on different areas and autoattack mobs on each location.

At the moment I use it like this:
1) I create the map
2) manually add all the interested locations to a string list type of variable
3) do the moves like this: #exec #walk %item(@xy_path, @max_path) // where @max_path = number of elements in @xy_path
4) attack @target
5) repeat 3-4 // until @max_path, then restart

It all works well with already done maps. However when new maps are introduced it's rather tiresome to create the list in step 2.
I figured out that I can create an XML and import the variable from there like this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<var name="xy_path" type="StringList">
<value>848|849|850|851</value>
<json>[848,849,850,851]</json>
</var>
</cmud>

But for this I need again the list of locations.
So to the question: Is there a way to "export" all location IDs on a given map that I could then use in my string list?
Or is there any other way to skip the manual part?

Thanks,
N.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Fri May 25, 2018 11:47 am   
 
Unless you need to hit a specific room along the way, the only thing you really need is the endpoint.
This was the map crawler I made to only move one room at a time.
It will automatically choose the shortest route.

#EVENT onMapCrawl {
#IF (@destination) {
$path=%pathexpand(%pathfrom(, @destination))
#EXEC %pop($path)
}}
_________________
Discord: Shalimarwildcat
Reply with quote
njung
Newbie


Joined: 22 May 2018
Posts: 7

PostPosted: Fri May 25, 2018 2:43 pm   
 
I may not fully understand your given idea, but what I need is not to get from point a) to point b) but to hit all or some rooms along the way (assuming point a) is the first and point b) is the last room on the map).
Imagine it as I check all the rooms on a given area and do an attack on each (depending on the area, I may skip a bunch as there are no enemies there).

Here's an example:

https://imgur.com/QP5AG3s

I marked the rooms with enemies with green while the rest are not interesting.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Sat May 26, 2018 11:39 am   
 
In that case, you need to come up with a path, or a chain of directional commands, that will hit every room in the area. Or close to it.
Although... Given that rather spotty coverage of rooms you actually wanna visit.
Once you have your list of important rooms you could always just:

#WALK %pop(xy_path)

And have it speedwalk you to the next room

One way or the other, there will always be a manual portion, either in finding the important rooms, or in defining a path that hits every potential important room.
Then there is always the code to kick off the attack once you have arrived.
_________________
Discord: Shalimarwildcat
Reply with quote
njung
Newbie


Joined: 22 May 2018
Posts: 7

PostPosted: Sat May 26, 2018 8:24 pm   
 
So back to the original question: Is there a way to "export" all room IDs on a given zone that I could then use in my string list?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Sun May 27, 2018 2:00 am   
 
Yes.

#SHOW %mapquery(%concat("Zoneid=",%zonenum))

Will show all the rooms in the current zone.
To get other zones, pass the zone's name: %zonenum("Central Park")
_________________
Discord: Shalimarwildcat
Reply with quote
njung
Newbie


Joined: 22 May 2018
Posts: 7

PostPosted: Sun May 27, 2018 7:02 am   
 
Thank you, again!

Going further... I was thinking maybe I could automatically color the rooms or interest?

Could I create a trigger such as... ?

"^You attack xyz" -> mark the room with green .... and maybe put the room ID into a new string list?
"^Nothing to attack" -> skip coloring

With this my goal would be achieved.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Sun May 27, 2018 11:14 am   
 
#CALL %maplocked(0)
#CALL %roomcol(,green)
#CALL %maplocked(1)
#ADDITEM newList %roomnum
_________________
Discord: Shalimarwildcat
Reply with quote
njung
Newbie


Joined: 22 May 2018
Posts: 7

PostPosted: Sun May 27, 2018 12:39 pm   
 
Great as ever, thank you!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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