返回列表 发帖
To save variables programatically: https://wiki.mudlet.org/w/Manual ... et#Saving_variables

On blinking: will think about what we can do. How is it used by the game and what do you need it in scripting for?

TOP

"If I don't click "Save Item" and "Save Profile" button, the code may lose. If I clicked them, the code won't lose. I have checked autosave on."

That's correct. All 'autosave' does is saves things you've already saved with 'Save Item'.

'Save Item' = update alias/trigger/etc
'Save Profile' = write to disk.

TOP

"^棒棒糖说道:「你去帮我弄根(.+)过来吧。」$" is the regex pattern and what is the line that you're matching? Also, what is the code? Or just export the trigger directly

TOP

本帖最后由 lboy 于 2019-3-12 11:20 AM 编辑

In the Pozhen task, there are eight directions. One of the directions is correct. The correct direction and some random directions are blinking. So if a direction is not blinking, the player will know it is wrong. Each time the player goes the wrong direction, he will lose some HP. If the player goes the correct direction, a npc will fight with him. If his HP is very low, he will be defeated by the npc.
Without displaying blinking text, the player has no way to know which directions are wrong. So he is likely to fail in the Pozhen task.
I want to catch the blinking directions so that I can know which directions are wrong.



This is the trigger of "^棒棒糖说道:「你去帮我弄根(.+)过来吧。」$":
<Trigger isActive="yes" isFolder="no" isTempTrigger="no" isMultiline="no" isPerlSlashGOption="no" isColorizerTrigger="no" isFilterTrigger="no" isSoundTrigger="no" isColorTrigger="no" isColorTriggerFg="no" isColorTriggerBg="no">
                                <name>New Trigger111</name>
                                <script>display(matches)
display(line)
display(multimatches)
if(utf8.find(line,"木杖")~=nil) then
        wupin="mu zhang"
elseif(utf8.find(line,"冰魄杖")~=nil) then
        slpaths={"e","n","n","w","s","w","n","s;s","e"}
        slpos=1
        wupin="bingpo zhang"
elseif(utf8.find(line,"冰杖")~=nil) then
        wupin="bing zhang"
else
        os.execute("aplay /home/xxx/Downloads/bibi.wav")
        return
end
funcEndPath=function()
        enableTrigger("pi木")
        send("wield axe;pi")
end
tempTimer(2,[[ppopkc.goRoom(3803)]])</script>
                                <triggerType>0</triggerType>
                                <conditonLineDelta>0</conditonLineDelta>
                                <mStayOpen>0</mStayOpen>
                                <mCommand>dw</mCommand>
                                <packageName></packageName>
                                <mFgColor>#ff0000</mFgColor>
                                <mBgColor>#ffff00</mBgColor>
                                <mSoundFile></mSoundFile>
                                <colorTriggerFgColor>#000000</colorTriggerFgColor>
                                <colorTriggerBgColor>#000000</colorTriggerBgColor>
                                <regexCodeList>
                                        <string>^棒棒糖说道:「你去帮我弄根(.+)过来吧。」$</string>
                                </regexCodeList>
                                <regexCodePropertyList>
                                        <integer>1</integer>
                                </regexCodePropertyList>
                        </Trigger>


The line I want to match is something like:
棒棒糖说道:「你去帮我弄根冰魄杖过来吧。」
Because the "matches" is nil, I have to use varialbe "line".

TOP

One thing - os.execute("aplay /home/xxx/Downloads/bibi.wav") - use playSoundFile() or os.execute("aplay /home/xxx/Downloads/bibi.wav &") because what you have will freeze the application while aplay is playing the sound

TOP

I couldn't make it happen. Modules definitely don't affect how code is run, only where it is saved. Here's a video: https://streamable.com/5l47g (ignore the ��� - it looks like `echo requires encoding to be utf8).

Can you make a video?

TOP

本帖最后由 lboy 于 2019-3-14 05:56 AM 编辑

回复 15# vadi


Thanks!
I retest the trigger and finally find what's wrong. It's not about modules or Chinese. Look at the command "dw", it's the problem. "dw" is one of my complex aliases. I just simply replace it with some random word like "a", and everything works fine.
BUT! It's not my alias' fault. I replace "dw" with a very simple alias, the problem still appears.
I will try to make a video.

This is the video: https://streamable.com/kpaf4

I made a mistake. The variable "matches" is not nil, but it is empty.

TOP

"command" is a command to the game, not an alias to run (tooltip also says this).

I recommend making a function in a script instead, and have both your alias and trigger call that function.

TOP

返回列表