Page 1 of 1

How to use Lua scripts in addSpecialExit()

Posted: Thu Mar 04, 2021 9:08 am
by visionok
I'm trying to use lua scripts as the command for a special exit. In the mapper gui interface the tool tip says prefix lua script with "script: ". So I entered, eg, script: send("stand"). The result is that instead of executing send("stand"), the whole line

script: send("stand")

gets sent to the mud. What am I missing?

Re: How to use Lua scripts in addSpecialExit()

Posted: Thu Mar 04, 2021 10:33 am
by Vadi
It could be that you're using the generic mapper, which needs to be updated to add support for it - is that the case for you?

Re: How to use Lua scripts in addSpecialExit()

Posted: Sat Mar 06, 2021 8:03 am
by visionok
No I'm not using the generic mapper. I'm using the AppImage (4.10), and installed a package specific for my mud. That package had its own mapper and uninstalled the generic mapper.

So it looks like support for "script: " is not actually built-in to mudlet itself but is down to the mapper script to process it.

I downloaded the source code and grep'ed it and found that there are some code to process to look for and process "script: " in mudlet-mapper.xml (that's the generic mapper right?). I'm going to study that code and see if I can incorporate it into the mapper that I'm using.

This is all in aid of hoping to get portals (global exits) working.

Re: How to use Lua scripts in addSpecialExit()

Posted: Sat Mar 06, 2021 5:19 pm
by visionok
It was quite straightforward, just copied and adapted a couple of lines from mudlet-mapper.xml. Now I've got a working portal system incorporated into the mapper :)

Re: How to use Lua scripts in addSpecialExit()

Posted: Sun Mar 07, 2021 7:22 am
by Vadi
Ah nice, glad you got it working!

Re: How to use Lua scripts in addSpecialExit()

Posted: Tue Apr 06, 2021 7:17 pm
by SlySven
visionok wrote:So it looks like support for "script: " is not actually built-in to mudlet itself but is down to the mapper script to process it.
Yep - it is a deceptive tool-tip which actually only ties up with the external generic mapper - you can put anything as the special exit name/command (unfortunately they are the same thing at the moment thought medium-long term I would like to see them split!) It is just that whatever your doSpeedWalk() function is that will process the exit names needs to interpret whatever is put there and the generic mapper code was (or should have been) designed to pick out what it might need to run as a lua script from what it might be expected to send literally "as-is" to the Game Server to use that special exit...