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

Outdated! New Version Available!

Started by account.username, 04 May 2014 - 08:45 AM
account.username #1
Posted 04 May 2014 - 10:45 AM
Edited on 31 May 2014 - 04:57 PM
Lyqyd #2
Posted 04 May 2014 - 07:56 PM
Please post the code, or I will have to lock your topic. Thanks.
account.username #3
Posted 04 May 2014 - 11:09 PM
Oops. I just forgot to put it in the post. Sorry!
awsmazinggenius #4
Posted 14 May 2014 - 05:20 AM
Lua comments use two hyphens. Keep the hashes though, as the forum software doesn't recognize Lua comments.

--# Valid Lua comment that the forum will highlight correctly. 
elcid534 #5
Posted 14 May 2014 - 01:53 PM
in your button code you have this

button.dispName = “Cool button”   #Whether or not it will display the percent above the button
might i suggest

button.dispName = “Cool button”   #What label it will display on the button
Edited on 14 May 2014 - 11:53 AM
account.username #6
Posted 14 May 2014 - 04:57 PM
@elcid534 that is a mistake in my code example. That is what that code does. Sorry!
Win7yes #7
Posted 14 May 2014 - 06:06 PM
Suggestion: Text Boxes

The player can type in them and the text that was typed in can be used for something like a print() or if the input matches something it triggers something


Also: Can the progress bar do something when it ends?
Can buttons do something when clicked?

And if they can, how do I make that

Another Suggestion: Progress bar progress. So It actually is a progress bar.
Edited on 14 May 2014 - 04:30 PM
account.username #8
Posted 14 May 2014 - 11:21 PM
@win7yes I don't understand what you are asking for with the progress bars. Also the buttons can be triggered when clicked. Here's some example code:


event,mouseClick,x,y = os.pullEvent("mouse_click")
buttonName = gui.checkButtons(x,y)
if buttonName == "but" then
    functionThatDoesSomething()
end

Also thank you for the text box idea. I will work on that!
Win7yes #9
Posted 15 May 2014 - 02:24 AM
With the progress bar I mean that it moves instead of being in one single position. Like any second it goes up one pixel. (Like a real Progress bar) Or is that already possible? I have been trying to do some random things to make it do that but it wasnt working.
account.username #10
Posted 16 May 2014 - 02:50 AM
@win7yes Try this and see if this is what you mean:


while true do
    sleep(1)
    bar.percent = bar.percent + 1
end

That's not actually the progress of something but that's an example of how to make it increase.
Win7yes #11
Posted 16 May 2014 - 04:00 AM
I tried that and it just got the program stuck or sending an error. Anyway I will try again
EDIT: That didnt work. I got the next thing: gui:43: bad argument: number expected, got nil
Nevermind, I got it working by adding some sort of redraw thing :)/>
Another Edit: I tried the button thing but it just says bios:366: [string "infoapp"]:25:expected "="
Edited on 16 May 2014 - 03:12 AM
account.username #12
Posted 17 May 2014 - 08:01 AM
@win7yes These must be errors on your part. I have used this api a lot and have never got it to error.