Post subject: Help with LUA @ Mame-RR
Joined: 8/16/2018
Posts: 4
Hello community, A friend called peon2 is working on a training mode for jojoban with FBA, but I want to port it to MAME because it is more comfortable to me. The problem I am facing is that I don't know what the internal inputs names are for the buttons, How can I check it? I did check the .cfg, used it in the LUA script but still doesn't read the input (I want to show an image with the pressed key). Direction inputs are working, but the rest of the buttons (button 1, start, coin...) are not. Thank you!
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
I don't know for sure, but I think the button names for your game can be seen in the input config dialog that you can access by pressing Tab with the game running. Otherwise, here's some wiki originally written by mz and dammit: https://github.com/TASVideos/mame-rr/wiki/Lua-scripting-functions
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 8/16/2018
Posts: 4
feos wrote:
I don't know for sure, but I think the button names for your game can be seen in the input config dialog that you can access by pressing Tab with the game running. Otherwise, here's some wiki originally written by mz and dammit: https://github.com/TASVideos/mame-rr/wiki/Lua-scripting-functions
Thank you. I tried with with the same names (P1 Button 1, Button 1, Button1, P1Button1, Button_1, and so on...) and none worked.
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Are you sending their names as strings?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 8/16/2018
Posts: 4
Thank you again! I have try print (joypad.get()) and I get the values, replaced those and now it is working! Now I am having a damn strange bug, but I will repost it when the lua hit the public (now it is a private beta).
Joined: 8/16/2018
Posts: 4
Ok so he gives me permission to ask this. Basically the problem is: The script have a record mode. You push the record button (Button 5 in this case) move around and then, you can push Button 5 again for stop recording or Button 6 for replay. The thing that MAME register and save everything but not Button 4 for some unknown reason. All the syntax and names are 100% correct so we don't know where is exactly the problem. Sorry for the double post!
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Are you using in-game buttons to control emulator behavior? If so, the input library should be used instead, see the bottom of the wiki (anchor link doesn't work for some reason).
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.