Walking Script

Posted by Yezrah on Sat 24 Feb 2018 03:45 AM — 6 posts, 28,139 views.

#0
I'm sorry to make a new thread post, I hope this is my last one. I have most of this scripting thing working.

However, I don't know how to create a script that runs like this..

if ((orc isin $1-)) && (standing isin $1-) { timer 1 1 sockwrite -n client.sock kill orc }
if ((orc isin $1-)) && (dies isin $1-) {
if ((%walk 1)) { timer 1 1 sockwrite -n client.sock go east }
if ((%walk 2)) { timer 1 1 sockwrite -n client.sock go south }
if ((%walk 3)) { timer 1 1 sockwrite -n client.sock go se }

if (you arrive isin $1) { inc %walk1
if ((%walk 1)) { timer 1 1 sockwrite -n client.sock go east }
if ((%walk 2)) { timer 1 1 sockwrite -n client.sock go south }
if ((%walk 3)) { timer 1 1 sockwrite -n client.sock go se }
}

Ok... something like this as an example of trying to explain what I want to do on Mushclient, using the only language i vaguely know...

I would like to be able to set up a walk pattern, perhaps, N, S, E, W, S, N, W, E, N(repeat) walking in a X intersection area.... killing mobs in each of these 5 paces as I go back and forth between the rooms.

I have no idea how to do it fluidly and clean and faultless...

I have a very sloppy system right now, where I created go e, and if e is not in, then go se, if se is not in, go s, and it's like one of those vacuum bots.. running around sweeping up mobs right now....

I'd like more intelligence in my mushclient script writing....

my fingers are getting too old to grind on muds like when i was a kid..... due to some arthritis in my right pinky finger (enter key finger) from a boxer's fracture i got when i was a teen... I need a program enter stuff for me.

any video links that anyone knows about if this has ever been brought up before... or any explanations would be great. Appreciate it.
Amended on Sat 24 Feb 2018 03:51 AM by Yezrah
Australia Forum Administrator #1
Rather than trying to code in a script language I have never seen, how about posting some example code/response? That would make it easier to visualize.

eg.

  • Send: N
  • Receive: (something that indicates you have gone north)
  • If you see: An orc is standing here.
  • Then send: kill orc
  • And wait for: You kill * orc.
  • If no orc, or once the orc is dead, go S and repeat the process
Australia Forum Administrator #2
Or, copy/paste a few dozen lines of you actually doing it.
USA Global Moderator #3
if ((orc isin $1-)) && ((standing isin $1-)) then { ... }

For this you would make a trigger that matches on text including both the words "orc" and "standing". ( Read https://www.gammon.com.au/forum/?id=8086 and https://www.gammon.com.au/mushclient/funwithtriggers.htm )


timer 1 1 sockwrite -n client.sock kill orc

Sending basic commands after a delay is done with the DoAfter script function, like DoAfter(1, "kill orc") ( Read https://www.gammon.com.au/scripts/doc.php?function=DoAfter ).
To use that function your trigger will need to send to Script ( Search for "Send to:" at https://www.gammon.com.au/scripts/doc.php?dialog=IDD_EDIT_TRIGGER )


if ((%walk 1))
and
inc %walk
will depend on which scripting language you use. We generally recommend Lua.

In Lua they could be something like
if tonumber(GetVariable("walk")) == 1 then

and
SetVariable("walk", tonumber(GetVariable("walk"))+1)
Amended on Sat 24 Feb 2018 04:25 PM by Fiendish
#4
someone from a mud told me the language i know how to script write in is called Visual Basic....

I didn't know because I didn't go to school for it, i just took some scrips that existed already in this scripter on mIRC client that was passed around on this game i played....

and opened it up and began messing around with it until I learned how to write my own script with it.... with lots and lots of errors and starting over, and... took a few days of hairpulling stress to learn to do it....

But, learning to read a language is easy.... if the language is there.

but... i dont know some of the commands like kill orc *

If I saw that in a script.. I would eventually figure it out...

But if i never seen it before, i would never know to try to enter it to see what it did....
Amended on Fri 02 Mar 2018 11:01 PM by Yezrah
Australia Forum Administrator #5
Maybe look at my tutorial about scripting basics:

http://www.gammon.com.au/forum/?id=10212