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

EasyButton API 1.0

Started by TheGamerOfAction, 07 July 2013 - 10:36 AM
TheGamerOfAction #1
Posted 07 July 2013 - 12:36 PM
EasyButton API by TheGamerOfAction

Current version: 1.0

What is it?
EasyButton is an API that I created because many
other Button APIs out there are a bit complex to use.

With this, is becomes a whole lot easier.


I designed it to be 'Just a button API'. Basically, this only creates buttons, it dosen't draw them.

How do I use it?
Commands:
  • easybutton.createButtonField(<x pos>, <y pos>, <x end pos>, <y end pos>, <name>) - Creates a button field
  • easybutton.removeButton(<name>) - Removes a button field. Useful for drop down menus, ect.
  • easybutton.waitForClicks() - Yields the program, and waits for the user to click a button. When a button is clicked, it will emit the event "button_click" with the parameters <name of button> and <mouse button used>. Best used with coroutines.
Events:
  • button_click - fired when a user clicks a button (after easybutton.waitForClicks() is called)
How do I get it?
Type into your terminal:

pastebin get YivGRJyj easybutton
or click here

NOTE: This is the first program (or API, for that matter) I have released

Hope you enjoy, you are free to use it in your programs, and credit is always good to give!
Zambonie #2
Posted 07 July 2013 - 12:50 PM
Looks pretty usefull and easy. I might be using this for some of my programs! Suggestion: Maybe you could make a easier monitor version of it?
TheGamerOfAction #3
Posted 07 July 2013 - 01:10 PM
Looks pretty usefull and easy. I might be using this for some of my programs! Suggestion: Maybe you could make a easier monitor version of it?
I'll see about a monitor version.
Zambonie #4
Posted 07 July 2013 - 05:21 PM
Ok, thanks!(I've always had problems with buttons on the monitors…)
wolfhowl42 #5
Posted 07 July 2013 - 11:30 PM
This is actually quite nice and helped me understand how to make my button API work more efficently. I do use this one as well. I find ways of using both.