How to use Lua scripts in addSpecialExit()

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: 5045
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: 5045
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: 1023
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...

caiyaozheng
Posts: 15
Joined: Sat Mar 18, 2023 5:34 am

Re: How to use Lua scripts in addSpecialExit()

Post by caiyaozheng »

can u show the script? i still don't understand, i am using mudlet mapper, but:

script: send("stand")

is not working

User avatar
SlySven
Posts: 1023
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 »

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

caiyaozheng
Posts: 15
Joined: Sat Mar 18, 2023 5:34 am

Re: How to use Lua scripts in addSpecialExit()

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

caiyaozheng
Posts: 15
Joined: Sat Mar 18, 2023 5:34 am

Re: How to use Lua scripts in addSpecialExit()

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

Post Reply