Post subject: Any button for turbo A and B for Visualboy?
Joined: 7/29/2011
Posts: 61
I know there is an autofire trigger button where it makes the button turbo until you turn it off but I want a key to make a button turbo only when I'm pressing it. I need to be able to use both regular B button and turbo B when I need. Another question, is it possible to throttle a maximum CPU usage for Visualboy? With this i7 computer it goes way too fast when I press the speedup key, I actually miss my old computer now, HAHA.
Editor, Experienced player (570)
Joined: 11/8/2010
Posts: 4038
Alt + the number keys toggle autofire for each individual button. You should be able to set custom keys for those toggles using Options>Input>Customize All Commands.
Joined: 7/29/2011
Posts: 61
No no, that makes it go Turbo regardless whether I'm pressing anything on the keyboard. I want it to turbo when and only when I press a button. This is the only emulator I know where the Turbo control is so idiotic.
Player (80)
Joined: 8/5/2007
Posts: 865
Lua scripting. I'm going to bed, but I'll write one for you in the morning...
Post subject: Re: Any button for turbo A and B for Visualboy?
Editor, Expert player (2079)
Joined: 6/15/2005
Posts: 3282
Santiago wrote:
Another question, is it possible to throttle a maximum CPU usage for Visualboy? With this i7 computer it goes way too fast when I press the speedup key, I actually miss my old computer now, HAHA.
I guess you mean a maximum speed limit for VBA. Just play normally. No one is forced to use the fast-forward key. Although, you can press the =+ key to speed up (say, to 200%) and -_ key to slow down.
Santiago wrote:
This is the only emulator I know where the Turbo control is so idiotic.
You might want to be careful how you word things. Anyway, I've used turbo/autofire and autohold for many years while doing Pokemon TASes and had no problem with it. Autohold is very useful and doesn't exist in some other emulators.
Joined: 7/29/2011
Posts: 61
Just play normally. No one is forced to use the fast-forward key.
No some parts are too slow and boring. I love the speedup key I've been using it since ever been using an emulator. Speedup key rocks! Thats one of the reasons besides save states that I preferred emulator to my real nintendo. But with computers becoming too fast now its not so good to speedup when it speeds up too much especially with gameboy that don't require so much CPU.
Although, you can press the =+ key to speed up (say, to 200%) and -_ key to slow down.
This is too awkward for regular play, it doesnt help that it only speeds up to 112% on first press then 125 then 150 etc., if it sped up to 400% right away then it would be better.
You might want to be careful how you word things.
Sorry english is not my first language though I think I speak it fluently by now. Thing is I learned my basic english first from video games and people from online games so I learned the harsh tones first I guess, ha. Bobo the king, thanks a lot.
Player (80)
Joined: 8/5/2007
Posts: 865
Santiago wrote:
Bobo the king, thanks a lot.
Oh. Right. Sorry, I forgot I promised you a Lua script. Okay, here's what I came up with in about 30 minutes: Download ABTurbo.lua
Language: lua

local function transferinput(thisinput) lastinput={} for k,v in pairs(thisinput) do lastinput[k]=v end thisinput=input.get() return thisinput, lastinput end local Aturbobutton='S' local Bturbobutton='A' local Aflag=true local Bflag=true local thisinput={} while true do thisinput, lastinput=transferinput(thisinput) if not(lastinput[Aturbobutton]) then Aflag=true end if not(lastinput[Bturbobutton]) then Bflag=true end if thisinput[Aturbobutton] then joypad.set(1, {A=Aflag}) end if thisinput[Bturbobutton] then joypad.set(1, {B=Bflag}) end Aflag=not(Aflag) Bflag=not(Bflag) emu.frameadvance() end
Very quick notes: You may set the turbo buttons at the lines
Language: lua

local Aturbobutton='S' local Bturbobutton='A'
Just change those to the keys you want to assign A and B turbo to. (Don't forget to use capital letters!) I have them set to S and A by default. There is a one frame delay between when you press the turbo button and when the Game Boy button is first pressed. I don't know where it's coming from and I don't have time to check-- I'm late for an appointment! Tell me how it works!
Joined: 7/29/2011
Posts: 61
Bobo the King thanks but how do I use this lua script? Do I need updated Visualboy because I am using old 2006 version.
Player (80)
Joined: 8/5/2007
Posts: 865
Santiago wrote:
Bobo the King thanks but how do I use this lua script? Do I need updated Visualboy because I am using old 2006 version.
I don't know-- I'm not all that knowledgeable concerning emulator history. 2006 sounds pretty old, though, and I think you'll need a new version. Download a new version of VBA (it should be one with RR-- rerecording) and then go to "Tools/Lua Scripting/New Lua Script Window..." then select "Browse...", load the script, and finally click "Run". If you haven't modified the script, press the A and/or S keys to verify that autofire is working.
Joined: 7/29/2011
Posts: 61
The script does not work. I am using VBA-rr-svn330.exe. If I run the script without a game being open it crashes and if I run it while having a game open then nothing appears on the display inpuit.
Player (80)
Joined: 8/5/2007
Posts: 865
Santiago wrote:
The script does not work. I am using VBA-rr-svn330.exe. If I run the script without a game being open it crashes and if I run it while having a game open then nothing appears on the display inpuit.
I just tested my script again in VBA 23.6 svn480 and it worked fine. I'm not sure where you found svn330. You can download the latest version here. Another possibility is that you simply have input display turned off. Press the comma key to turn it on.
Joined: 7/29/2011
Posts: 61
I got it to work even on the svn330 I didn't know the lua window had to stay open. I closed it last time. I feel so dumb now. I'll be using the latest version now, the 330 I had since forever to play the latest movies released because they desync on the 2006 visualboy. Now you all use that bizhawk which doesn't work on my computer period so I get the MKV movies instead. :) Thanks for helping me out Bobo the King.
Player (80)
Joined: 8/5/2007
Posts: 865
Glad I could help! I hope you get a lot of use out of it!
Joined: 6/27/2008
Posts: 49
Hello all, I have a question of lua: Bobo the King's code is good but it ignores other buttons when the turbo button is being pressed. I'm trying to write a lua script but it doesn't work. Here's my code:
Language: lua

print("Turbo, B: H; R: U; Y: A") local PressDownA = false local PressDownB = false local PressDownR = false gui.register(function() local KeyPress = input.get() if KeyPress["H"] or KeyPress["U"] or KeyPress["Y"] then local Buttons = joypad.get(0) if not emu.lagged() then if KeyPress["H"] then Buttons["B"] = PressDownB PressDownB = not PressDownB end if KeyPress["U"] then Buttons["R"] = PressDownR PressDownR = not PressDownR end if KeyPress["Y"] then Buttons["A"] = PressDownA PressDownA = not PressDownA end else if KeyPress["H"] then Buttons["B"] = PressDownB end if KeyPress["U"] then Buttons["R"] = PressDownR end if KeyPress["Y"] then Buttons["A"] = PressDownA end end print(Buttons) joypad.set(0, Buttons) else PressDownA = false PressDownB = false PressDownR = false end end)
I'm a programmer but this is my first time writing lua. I write some logs and it seems everything goes fine. Emu used: v23.6 SVN480 Thanks