|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: Mon Sep 03, 2007 1:33 am
Array VB Script Question |
I am setting up my script to keep tracking of my walking through an area and to put each direction traveled into an array called "Back".
I will being doing various tasks in the area as well, killing, looting, etc.
At any point i want to activate the array in reverse(using a simple loop to convert directions?) from any point in the area and to take me back to the start.
Is this feasible ? I'm not even sure im explaining it correctly :P |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Mon Sep 03, 2007 2:14 am |
Just couple of ideas, I bet someone will go more in detail anyway.
If we'd assume that the movement part of your script is a string list of directions (newseu for example)
Then you could do
%pathcompress(list)
which would make your string list in a form of a speedwalk: for example if you have string list of n|n|n|e|s it would make it to 3nes
And then, you could
make a path of it.
#path walk_path {%pathcompress(list)}
And then you could reverse it
%pathreverse(walk_path)
Its late atm etc but those are the 2 ideas I came quickly up with and I hope this helps some.
ps. I haven't used #path in that manner myself so I have no idea if it'll work, but it should give the general idea.
Prog |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Sep 03, 2007 2:16 am |
Not very efficiently. WSH languages (not Lua in CMUD 2 or zScript) have no way of sending information to the MUD. You could maybe rig something using an expression trigger, where the expression trigger watches a CMUD variable that you set using VB, and then the expression trigger runs your code.
All that's a lot of hassle though when you could do this very simply either in Lua in CMUD 2 or in zScript. With Lua or zScript, you'll have the %reversedir function, too.
EDIT: Ninja'd by prog :( That's a good explanation of a zScript approach, anyway. |
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Mon Sep 03, 2007 4:18 am |
How about using the built in path recording? (You just want to record directions and maybe door commands, right?)
Look at #mark to get started. |
|
|
|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: Mon Sep 03, 2007 11:10 am |
Prog,
Your suggestion sounds pretty good, but I'm not quite sure it fits what I want to do.
It's kinda like the mapper program from Zmud. At any point if you have a correct map you can click on a spot and it automatically walks you to that spot from anywhere.
I basically want to be able to do that but through my script. Is there already something that does this?
Oh... and whats LUA ?:P I'm pretty much a big noob to CMud. And Cmud 2? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Sep 03, 2007 11:34 am |
CMUD 2 is just version 2 of CMUD. It's in beta at the moment. Lua is a scripting language, more info is here and here. Lua was included in CMUD 2 as an alternative to zScript.
If all you want is the mapper, you're in luck - CMUD has the exact same mapper that zMUD does. Just click the map button on the toolbar. |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Mon Sep 03, 2007 12:53 pm |
I first didn't suggest map because you didn't mention it on your original post.
Doing all this via map can be easier but it can also be tricker.
For example, you can map the Zone you want to kill in. Then give a bunch of rooms shortids and make a string list containing them.
Lets say you're having a Zone that looks like a square. Then you can give certain names to the each of the edges, and put them into a list.
List=edge1|edge2|edge3|edge4
And then you could set up a system which goes from point A (edge1) to B (edge4) and right back to A once it has hit its destination.
Basically though, it is pretty much the same as doing a pre-defined string list with directions and go from A to B and once you're in B and all the directions in the list are called and its empty, list is generated again but in reverse.
I hope I cleared up at least some things.
Prog |
|
|
|
Haldrik Wanderer
Joined: 03 Sep 2007 Posts: 88
|
Posted: Tue Sep 04, 2007 12:59 am |
Ok... I think im starting to get a handle on this.
I'm at work right now so I can't test this out...
So for instance I map 2 zones. Normally you can click on any square and it will walk you to that square.
But from what I gather is i can give these rooms "shortId's which lets me access them through a script or alias for example...
So for example I set up my script to run around killing things and my inventory is now full. In the past I would just have a "home" room in the loop which would check to see if the inventory is full. But I wanted it to be able to go back to a safe point at ANY point in the script journey.
So.... short ID's on room names which i can then use to access the speed walk mapper W/O have to click on the map.
Does this sound right? |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Tue Sep 04, 2007 6:16 am |
Yeah, you got the general idea of it.
If you're giving the rooms you want to move to shortID's, you can for example use #walk <shortid> syntax to go to that room.
However the core idea is a lot more complex.
Consider having 2 core system parts for moving.
The first one is used to get the most current shortID from the List provided.
Then it'd calculate the string list of direction based on the point you currently are on the Map from where you wanna go.
Then another core system bit is using that string list of directions to call one of them, then move, then if nothing's killable or that like in the room it moved to, it will call another direction from the list.
I hope this made it somewhat clearer.
I'm getting ready to be off to Uni myself so I have to cut it shorter than it'd deserve but.
Think about all this and look up stuff, and when you have more questions I'm more than glad to help/answer if I can.
Prog |
|
|
|
|
|