This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
joshgreat's profile picture

help with buttons

Started by joshgreat, 26 July 2017 - 10:14 AM
joshgreat #1
Posted 26 July 2017 - 12:14 PM
hey guys im having a problem with a chunk of my code, it doesnt throw an error though.

basically i am making an app store and i have made buttons, the buttons work on the rest of the OS but on this part they dont, i click them and nothing happens

the code is in the pastebin bellow
https://pastebin.com/2i6QbhxH
or
pastebin get 2i6QbhxH

thanks in advance
The Crazy Phoenix #2
Posted 26 July 2017 - 12:57 PM
Are you using an advanced computer / monitor? "mouse_click" only works on advanced.
If you're only planning on listening to the "mouse_click" event, use os.pullEvent("mouse_click") so that you don't have to manually filter events.

The given snippet of code won't compile because there are 2 "end" statements too many.
joshgreat #3
Posted 26 July 2017 - 01:19 PM
hi thanks for answering so fast.

i am using an advanced computer but the amount of "end" statements are fine and if i add more or take away more i get an error.

EDIT : The buttons are formatted the same throughout the whole program and they work fine but this doesn't.
Edited on 26 July 2017 - 11:21 AM
Bomb Bloke #4
Posted 26 July 2017 - 02:37 PM
This sort of thing:

cx < choice1:len()

… should be along the lines of this sort of thing:

cx < x1 + choice1:len()

The reason you need your excess "end"s is because you're using "else if" where you could be using "elseif".
joshgreat #5
Posted 27 July 2017 - 03:31 PM
This sort of thing:

cx < choice1:len()

… should be along the lines of this sort of thing:

cx < x1 + choice1:len()

The reason you need your excess "end"s is because you're using "else if" where you could be using "elseif".
sadly this doesnt seem to be the case as i modified the code for a couple of functions, the app store code still didnt work and the other stopped working, and i dont use 'elseif' because i am used to using 'else if'

EDIT: Nvm i was modifying the wrong thing sorry about that, but nevertheless thank you so much for the help
Edited on 27 July 2017 - 01:33 PM