Page 1 of 2

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

Re: How to use Lua scripts in addSpecialExit()

Posted: Sat Jun 17, 2023 11:18 pm
by caiyaozheng
can u show the script? i still don't understand, i am using mudlet mapper, but:

script: send("stand")

is not working

Re: How to use Lua scripts in addSpecialExit()

Posted: Sun Jun 18, 2023 11:28 am
by SlySven
Up to now that only works for MUDs that use the IRE Mapper package that we bundle - the "generic" one doesn't support that "script:" prefix - however, good news, work is actually in progress to make that work for that one as well, you might want to watch this GitHub Pull-Request to see when it goes intot the PTB (Public Test Builds): https://github.com/Mudlet/Mudlet/pull/6887 ...

Re: How to use Lua scripts in addSpecialExit()

Posted: Mon Jun 19, 2023 10:26 am
by caiyaozheng
indeed in IREs Mapper package it seems scrtpt: as prefix is working, yet when using that package, i couldn't locate my current room...

anyway ,thanks a lot, let me try your test version!

Re: How to use Lua scripts in addSpecialExit()

Posted: Tue Jun 20, 2023 12:26 pm
by caiyaozheng
SlySven wrote:
Sun Jun 18, 2023 11:28 am
Up to now that only works for MUDs that use the IRE Mapper package that we bundle - the "generic" one doesn't support that "script:" prefix - however, good news, work is actually in progress to make that work for that one as well, you might want to watch this GitHub Pull-Request to see when it goes intot the PTB (Public Test Builds): https://github.com/Mudlet/Mudlet/pull/6887 ...
i downloaded the test version, input:

script:tempTimer(4,[[send("southup")]] in the special exits row

not working.

so I set an Alias in mudlet , delayed_southup short for tempTimer(4,[[send("southup")]]
then I input:

script:delayed_southup

still not working.

it seems the test version changed nothing as compared to the current version.