how-to

Jor'Mox
Posts: 1092
Joined: Wed Apr 03, 2013 2:19 am

Re: how-to

Post by Jor'Mox » Sun May 13, 2018 11:40 am

So, first, I would recommend using some character as an indicator that a string of directions follows. I'll give an example, but you can obviously choose whatever you want.

Here is a pattern that should work: ^\>([\dnsewud]+)
Then, you can use some code like this to pull the directions apart and send the relevant commands:
Code: [show] | [select all] lua
for num, dir in string.gmatch(matches[2],"(%d*)([nswedu][ew]?)") do
	if num == "" then num = 1 end
	for k = 1,num do
		send(dir,false)
	end
end
Just know that if you want to move one space to the east or west, you will need to precede it with a 1, instead of not using a number, or it could cause confusion to the script (this is obvious for cases like 'ne', 'sw', etc., but also applies to all other cases, such as 'de', 'uw', 'ew').

khiren
Posts: 14
Joined: Wed Apr 25, 2018 3:01 pm

Re: how-to

Post by khiren » Sun May 13, 2018 6:40 pm

Jor'Mox wrote:
Sun May 13, 2018 11:40 am
So, first, I would recommend using some character as an indicator that a string of directions follows. I'll give an example, but you can obviously choose whatever you want.

Here is a pattern that should work: ^\>([\dnsewud]+)
Then, you can use some code like this to pull the directions apart and send the relevant commands:
Code: [show] | [select all] lua
for num, dir in string.gmatch(matches[2],"(%d*)([nswedu][ew]?)") do
	if num == "" then num = 1 end
	for k = 1,num do
		send(dir,false)
	end
end
Just know that if you want to move one space to the east or west, you will need to precede it with a 1, instead of not using a number, or it could cause confusion to the script (this is obvious for cases like 'ne', 'sw', etc., but also applies to all other cases, such as 'de', 'uw', 'ew').
Hey Jor'Max,

Thanks for reply but I am a bit confused what to do with this.

Pattern is part of trigger, right?
lua code is part of that same trigger?

Jor'Mox
Posts: 1092
Joined: Wed Apr 03, 2013 2:19 am

Re: how-to

Post by Jor'Mox » Sun May 13, 2018 7:11 pm

An alias, not a trigger. Only aliases look at what you are sending, while triggers look at what you are receiving from the game.

User avatar
SlySven
Posts: 903
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: how-to

Post by SlySven » Sun May 13, 2018 11:17 pm

I have heard of clients (or was it servers themselves - they might do) that accept multiple movement commands like that...

... it ought to be possible to do something to handle that - do you need a small time delay between each step or between each change of direction to prevent triggering an anti-spamming action on the MUD server? Note that if it is the Server that can accept multiples that suggests that a more sophisticated speed-walk function can be created compared to the default one that is currently in the supplied `Other.lua`!

Oops, reply to message at end of first page without spotting there were more posts on the second. :blush:

khiren
Posts: 14
Joined: Wed Apr 25, 2018 3:01 pm

Re: how-to

Post by khiren » Mon May 14, 2018 3:54 pm

Jor'Mox wrote:
Sun May 13, 2018 7:11 pm
An alias, not a trigger. Only aliases look at what you are sending, while triggers look at what you are receiving from the game.
Okay I will try it as alias. Thanks

khiren
Posts: 14
Joined: Wed Apr 25, 2018 3:01 pm

Re: how-to

Post by khiren » Mon May 14, 2018 3:57 pm

SlySven wrote:
Sun May 13, 2018 11:17 pm
I have heard of clients (or was it servers themselves - they might do) that accept multiple movement commands like that...

... it ought to be possible to do something to handle that - do you need a small time delay between each step or between each change of direction to prevent triggering an anti-spamming action on the MUD server? Note that if it is the Server that can accept multiples that suggests that a more sophisticated speed-walk function can be created compared to the default one that is currently in the supplied `Other.lua`!

Oops, reply to message at end of first page without spotting there were more posts on the second. :blush:
Previously I used tintin++ and there, within configuration there is option for speedwalk which allows input like I have described.
Code: [show] | [select all] lua
################################## CONFIGURATIONS ###################################
[SPEEDWALK    ] [      ON] Your input is scanned for speedwalk directions
But since I decided to move to Mudlet and learn something new I find some simplest stuff not working and some complex stuff works easy...so I am still whhaaattt

User avatar
SlySven
Posts: 903
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: how-to

Post by SlySven » Mon May 14, 2018 4:13 pm

Yeah, the fact that Mudlet runs all triggers whereas TinTin++ only runs one and there is a 10 level priority system (default 5) to help to decide which one gets run catches out some people - as does the different ways to introduce time delays to running things (Mudlet, as a GUI application does not offer to stop and wait to do something because it needs to handle other/multi-task things as well).... {N.B. I have previously contributed to TinTin++ as well. :geek:}

khiren
Posts: 14
Joined: Wed Apr 25, 2018 3:01 pm

Re: how-to

Post by khiren » Mon May 14, 2018 4:47 pm

SlySven wrote:
Mon May 14, 2018 4:13 pm
Yeah, the fact that Mudlet runs all triggers whereas TinTin++ only runs one and there is a 10 level priority system (default 5) to help to decide which one gets run catches out some people - as does the different ways to introduce time delays to running things (Mudlet, as a GUI application does not offer to stop and wait to do something because it needs to handle other/multi-task things as well).... {N.B. I have previously contributed to TinTin++ as well. :geek:}
I have fond memories from tintin++ days. I still can't figure out how to use alias within other trigger....I know I know tintin spoiled me :)

for example I have alias that does this
Code: [show] | [select all] lua
pattern : ^sle$

code:
send "get xxx knapsack"
send "get all xxx"
send "rem knapsack"
send "rem rabbit.foot"
send "wear pillow"
send "wear woolen.blanket"
send "sleep"
i've tried to use this alias within trigger but failed so badly...
Code: [show] | [select all] lua
^(.*) tells the group (.*): "pfull"$

code:
send "sle"
So what I did is copy code from alias into code..but this is not user friendly when I need to update alias sle.
Last edited by khiren on Mon May 14, 2018 4:54 pm, edited 1 time in total.

Jor'Mox
Posts: 1092
Joined: Wed Apr 03, 2013 2:19 am

Re: how-to

Post by Jor'Mox » Mon May 14, 2018 4:53 pm

To have things you send to the game check aliases, you need to use the expandAlias function, rather than the send function.

User avatar
Vadi
Posts: 4641
Joined: Sat Mar 14, 2009 3:13 pm

Re: how-to

Post by Vadi » Mon May 14, 2018 4:54 pm

I think you'll find the send() documentation helpful here! https://wiki.mudlet.org/w/Manual:Basic_Essentials#send

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests