How to use Lua scripts in addSpecialExit()

Post Reply
visionok
Posts: 22
Joined: Thu Mar 04, 2021 8:50 am

How to use Lua scripts in addSpecialExit()

Post 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?

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

Re: How to use Lua scripts in addSpecialExit()

Post 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?

visionok
Posts: 22
Joined: Thu Mar 04, 2021 8:50 am

Re: How to use Lua scripts in addSpecialExit()

Post 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.

visionok
Posts: 22
Joined: Thu Mar 04, 2021 8:50 am

Re: How to use Lua scripts in addSpecialExit()

Post 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 :)

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

Re: How to use Lua scripts in addSpecialExit()

Post by Vadi »

Ah nice, glad you got it working!

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

Re: How to use Lua scripts in addSpecialExit()

Post 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...

Post Reply