Hello guys (or girls what ever you feminists!!)
I have a little problem in my code...
I have made a file which should make bunch of buttons.
And it does that perfectly well!!! But the real problem is, that some buttons can't be pressed.
To be exact: the 'Show FPS' button in the options, and every button in the pause menu(yes EVERY SINGLE ONE OF THEM).
Since the code is WAY too long, I'll simply put a love file under this post
There are no libraries used and the code is commented(more or less) but if you have something to ask, fell free to tell me!!!
Thanks
P.S. I hate to do this.. can't even solve a basic bug on my own
Help me with buttons please!!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 125
- Joined: Wed Nov 26, 2014 6:43 am
Re: Help me with buttons please!!
The FPS button issue is due to a logic error in boolean checks, specifically this code under the "option_button_click" function in menu.lua:
It only toggles fpsMode if fpsMode is already true. The fix is simple:
The pause menu issue is because the "pause_button_click" doesn't accept the button parameter.
Code: Select all
function option_button_click(button)
-- ...
if fpsMode then
if fpsMode then
fpsMode = false
else
fpsMode = true
end
end
-- ...
end
Code: Select all
function option_button_click(button)
-- ...
fpsMode = not fpsMode
-- ...
end
Code: Select all
function pause_button_click() -- whoops!
for i,v in ipairs(pauseBtnDta) do
if v.float and button == 'l' then
mainstate = v.ID
end
end
end
-
- Party member
- Posts: 125
- Joined: Wed Nov 26, 2014 6:43 am
Re: Help me with buttons please!!
EDIT: Nope just got it... stupid meKingdaro wrote: The pause menu issue is because the "pause_button_click" doesn't accept the button parameter.Code: Select all
function pause_button_click() -- whoops! for i,v in ipairs(pauseBtnDta) do if v.float and button == 'l' then mainstate = v.ID end end end
I am really sorry but what do you mean with "doesn't accept the buttton parameter"
Re: Help me with buttons please!!
A parameter or more commonly called 'argument' is a variable a function accepts between its parentheses. In this example:
'a', 'b', and 'c' are all arguments to this function.
So all you'll want to do is edit that line:
Code: Select all
function foo(a, b, c)
return a + b - c
end
So all you'll want to do is edit that line:
Code: Select all
function pause_button_click(button)
Last edited by Kingdaro on Wed Mar 04, 2015 9:09 am, edited 1 time in total.
-
- Party member
- Posts: 125
- Joined: Wed Nov 26, 2014 6:43 am
Re: Help me with buttons please!!
Yes I got that before your reply but thanksKingdaro wrote:Code: Select all
function pause_button_click(button)
Who is online
Users browsing this forum: Google [Bot], MaxGamz and 5 guests