vadi
发表于 2019-3-12 14:04:54
"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.
vadi
发表于 2019-3-12 14:14:39
"^棒棒糖说道:「你去帮我弄根(.+)过来吧。」$" is the regex pattern and what is the line that you're matching? Also, what is the code? Or just export the trigger directly
lboy
发表于 2019-3-12 19:12:07
本帖最后由 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,[])</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".
vadi
发表于 2019-3-14 01:15:11
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
vadi
发表于 2019-3-14 01:55:21
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?
lboy
发表于 2019-3-14 13:32:48
本帖最后由 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.
vadi
发表于 2019-3-17 14:45:05
"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.
vadi
发表于 2019-3-22 14:37:54
@lboy did you get it figured out?
lboy
发表于 2019-3-23 12:01:46
本帖最后由 lboy 于 2019-3-23 04:15 AM 编辑
回复 18# vadi
I found variables are auto exported in 3.18. Thanks for your job!
I will be careful to use aliases in trigger command. But it is still a bug of Mudlet, right?
The rewriting of gps tool is done. But I need more test. And I need to separate it from my existing codes. As I used c++ to make it, I have to test it under windows. I may release it in 15-20 days.
And I have a question. Modules loaded by Module Manager will synchronize all codes and all trigger state. How to make them synchronize only codes but not trigger states? Some triggers need to be enabled in profile A, and they need to be disabled in profile B. And trigger states will change frequently. I don't want them to be synchronized.
vadi
发表于 2019-3-24 16:44:53
"I will be careful to use aliases in trigger command" - no, not a bug, "command" gets sent straight to the game (see tooltip). Just confusing design.
You raise a good point about trigger states. When modules are synced, they're uninstalled and reinstalled - so 'sysSyncUninstallModule' and 'sysSyncInstallModule' should be raised for the module. Try using that to reset the trigger states to what they should be?