Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mp.input menu support and fix lua interpreter compatibility #24

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

dyphire
Copy link
Collaborator

@dyphire dyphire commented Oct 16, 2024

代码尚未完成。奇怪的是脚本在input.select中无法触发submit的回调,但在其他脚本中测试正常,按照官方手册的用法使用

需要有人帮助定位和解决这一问题

Edit: 已解决

@dyphire dyphire changed the title [WIP] feat: add mp.input.select() menu support and fix lua interpreter compatibility [WIP] feat: add mp.input menu support and fix lua interpreter compatibility Oct 16, 2024
@Tony15246
Copy link
Owner

代码尚未完成。奇怪的是脚本在input.select中无法触发submit的回调,但在其他脚本中测试正常,按照官方手册的用法使用

需要有人帮助定位和解决这一问题

input.get()中不存在无法触发submit回调的问题,只有input.select()才会有是吗?我晚上回寝室也在电脑上测试一下看看,找找是什么问题。

@dyphire
Copy link
Collaborator Author

dyphire commented Oct 16, 2024

代码尚未完成。奇怪的是脚本在input.select中无法触发submit的回调,但在其他脚本中测试正常,按照官方手册的用法使用
需要有人帮助定位和解决这一问题

input.get()中不存在无法触发submit回调的问题,只有input.select()才会有是吗?我晚上回寝室也在电脑上测试一下看看,找找是什么问题。

对,input.get() 中表现正常,只有 input.select() 里的回调出现了问题

@dyphire dyphire changed the title [WIP] feat: add mp.input menu support and fix lua interpreter compatibility feat: add mp.input menu support and fix lua interpreter compatibility Oct 16, 2024
@dyphire dyphire marked this pull request as ready for review October 16, 2024 17:02
@dyphire
Copy link
Collaborator Author

dyphire commented Oct 16, 2024

突然想到了有可能是mp.input的回调争用导致的,测试了下果不其然。简单加下延迟处理即可正常回调了

效果示意:

test2.mp4

@dyphire dyphire force-pushed the input branch 4 times, most recently from 3616f7f to f04d552 Compare October 16, 2024 17:30
@Tony15246
Copy link
Owner

突然想到了有可能是mp.input的回调争用导致的,测试了下果不其然。简单加下延迟处理即可正常回调了

原来如此,我大概猜测到了是input-event没有被传递给正确的回调函数,因为在日志里确实看到了前后两个submit事件都是被触发了的,也carry了正确的参数,但回调函数没有执行。我debug了半天一直没想明白是为什么,原来是这样。

[   3.303][i][uosc_danmaku] before select
[   3.303][d][cplayer] Run command: script-message-to, flags=64, args=[target="console", args="get-input", args="uosc_danmaku", args="{\"items\":[\"鬼灭之刃\",\"鬼灭之刃 兄妹的羁绊\",\"鬼灭之刃 无限列车篇\",\"鬼灭之刃 游郭篇\",\"鬼灭之刃 柱合会议・蝶屋敷篇\",\"鬼灭之刃 那田蜘蛛山篇\",\"鬼灭之刃 无限列车篇\",\"鬼灭之刃 浅草篇\",\"鬼灭之刃 鼓屋敷篇\",\"鬼灭之刃 锻刀村篇\",\"鬼灭之刃 游郭篇 特別编集版\",\"鬼灭之刃 柱训练篇\"],\"prompt\":\"Filter:\"}"]
[   3.332][d][cplayer] Run command: script-message-to, flags=64, args=[target="uosc_danmaku", args="input-event", args="opened"]
...
[   4.872][d][cplayer] Run command: script-message-to, flags=64, args=[target="uosc_danmaku", args="input-event", args="submit", args="[4]"]
[   4.872][d][cplayer] Run command: script-message-to, flags=64, args=[target="uosc_danmaku", args="input-event", args="closed", args="[\"\",1]"]

Copy link
Owner

@Tony15246 Tony15246 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks all good to me

@Tony15246 Tony15246 merged commit 84afe3e into Tony15246:main Oct 16, 2024
dyphire pushed a commit to dyphire/uosc_danmaku that referenced this pull request Jan 25, 2025
feat: add `mp.input` menu support and fix lua interpreter compatibility
dyphire pushed a commit to dyphire/uosc_danmaku that referenced this pull request Jan 25, 2025
feat: add `mp.input` menu support and fix lua interpreter compatibility
@dyphire dyphire deleted the input branch January 25, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants