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

Lyqyd's touchpoint API hating me!

Started by X3ME, 03 March 2016 - 07:26 PM
X3ME #1
Posted 03 March 2016 - 08:26 PM
So, I can't even get the example program to work..
I ALWAYS GET AN ERROR WITH THE FU**ING EVENT HANDLING PART!

Using this:

--# load the Touchpoint API
os.loadAPI("touchpoint")
--# intialize a new button set on the top monitor
local t = touchpoint.new("top")
--# add two buttons
t:add("left", nil, 2, 2, 14, 11, colors.red, colors.lime)
t:add("right", nil, 16, 2, 28, 11, colors.red, colors.lime)
--# draw the buttons
t:draw()
while true do
	    --# handleEvents will convert monitor_touch events to button_click if it was on a button
	    local event, p1 = t:handleEvents(os.pullEvent())
	    if event == "button_click" then
			    --# p1 will be "left" or "right", since those are the button labels
			    --# toggle the button that was clicked.
			    t:toggleButton(p1)
			    --# and toggle the redstone output on that side.
			    rs.setOutput(p1, not rs.getOutput(p1))
	    end
end

Getting:
startup:16: attempt to call nil
Creator #2
Posted 03 March 2016 - 08:51 PM
The error message says that toggleButton does not exist. I am no expert in touchpoint and know if it does, but this is the info the error message gives me. Make sure it is the right name.
Lupus590 #3
Posted 03 March 2016 - 08:52 PM
t:toggleButton expects a string which represents a button label (I think) is p1 a button label?
Edited on 03 March 2016 - 07:54 PM
Dragon53535 #4
Posted 04 March 2016 - 01:22 AM
That code should work without error, try restarting your in game computer.
Lyqyd #5
Posted 05 March 2016 - 01:33 AM
The code posted above does, in fact, work just fine. What version of ComputerCraft are you using, and have you made any edits to the program or the API, either intentionally or by accident?
X3ME #6
Posted 06 March 2016 - 10:01 PM
Freshly Installed API, tried on several computers; CC 1.7.4
No edits to the program, no edits to the API, tried on several minecraft worlds.
Should point out I am using Debian Sid with OpenJDK 7
Bomb Bloke #7
Posted 06 March 2016 - 10:39 PM
To generate that specific error, t would need to contain the add, draw and handleEvents functions, but NOT the toggleButton function. The API is written such that that can't happen: at least, not when used with the code you've provided here.
X3ME #8
Posted 06 March 2016 - 10:58 PM
I swear I am using exactly THIS code and the API is NOT modified.
Dragon53535 #9
Posted 06 March 2016 - 11:01 PM
Do you have a monitor on top of the computer?
Bomb Bloke #10
Posted 06 March 2016 - 11:10 PM
I swear I am using exactly THIS code and the API is NOT modified.

Nevertheless, that code can't generate that error. The sixteenth line is calling a certain function that doesn't exist, but that line can't be reached unless it does - so long as you're running the code you think you're running, anyway.

I've tested it using both the pastebin and packman versions of the API in concern. It works, as written.

Do you have a monitor on top of the computer?

If he didn't, he still wouldn't get that error.
Edited on 06 March 2016 - 10:11 PM
Dragon53535 #11
Posted 06 March 2016 - 11:18 PM
If he didn't, he still wouldn't get that error.

Oh i got that, but that's the only other thing that might go wrong since he apparently has the correct api and his code is there.
Lyqyd #12
Posted 07 March 2016 - 01:32 AM
Okay, perhaps it would be helpful if you used the pastebin program to upload whatever is on the computer. pastebin put touchpoint and pastebin put startup, then give us the resulting pastebin links so we can see if the download process has somehow resulted in you receiving corrupted files.
X3ME #13
Posted 07 March 2016 - 06:00 PM
Im going to try to, once again, download the API and the program, if it still doesnt work i'll do that..
X3ME #14
Posted 07 March 2016 - 08:05 PM
Nope, nada

touchpoint - WJPM2BzP
startup - vzTEMy6B
Bomb Bloke #15
Posted 08 March 2016 - 02:24 AM
That's still valid code, though I notice it's not a match for what you first posted - you've got different content on line 16 within the startup paste, due to the additional line breaks.

To be clear, the pasted code is giving you "startup:16: attempt to call nil" - letter for letter, correct?

I'm almost ready to blame OpenJDK, but the idea that it could generate this sort of behaviour is pretty bizarre. There's bound to be a simpler explanation.
Lyqyd #16
Posted 08 March 2016 - 02:31 AM
Well, with that being the line 16 in question, is it t:handleEvents or os.pullEvent that's throwing the error? Does the error get thrown immediately upon startup, or do you have to click the monitor/press a key/etc. first?
X3ME #17
Posted 08 March 2016 - 06:38 PM
Its probably os.pullEvent because it only happends after I click the monitor for the first time after reboot.

And yeah it gives me exactly "startup:16: attempt to call nil"
Lyqyd #18
Posted 08 March 2016 - 06:58 PM
If it's waiting for an event to come in before crashing, that points to t:handleEvents being the issue, which is bizarre. The two :add calls and the :draw call should have failed if the instance isn't getting set up properly. This is difficult to debug, since it seems to work everywhere else. Is there any way you can try this with a more normal Java install?
X3ME #19
Posted 08 March 2016 - 07:24 PM
Well I am using Linux after all but I can install plain java
lemme try that
Creator #20
Posted 08 March 2016 - 07:39 PM
How would a different Java version affect the functioning of a Lua program?
X3ME #21
Posted 08 March 2016 - 07:40 PM
This^

And I can't do it, dependencies issues.
I should have never switched from my reliable Arch Linux to Debian :(/>

Should I share the world folder for you guys to test?
Lyqyd #22
Posted 08 March 2016 - 07:43 PM
Might as well share the world folder.

How would a different Java version affect the functioning of a Lua program?

It shouldn't. But the error isn't making much sense, so we're trying to eliminate differences between the working environment and the non-working one.
X3ME #23
Posted 08 March 2016 - 08:06 PM
I can't get rid of openjdk/openjre, dependencie issues;
damn Debian I should have sticked with Arch…

Here you have the world :
https://mega.nz/#!n0MwHJJA!g5-2uW6fam-SJv4E_ThXK8EVrc6rLdt6uUmGN0-8P5s
Bomb Bloke #24
Posted 08 March 2016 - 11:13 PM
Where are the affected systems? I can place new ones and they check out just fine, but I can't locate the ones you've been having trouble with.
X3ME #25
Posted 11 March 2016 - 10:55 PM
Where are the affected systems? I can place new ones and they check out just fine, but I can't locate the ones you've been having trouble with.

All the systems are affected… Even new ones, I just realized my HDD was near dying when I was playing minecraft, It died 2 days after my last reply.. Just bought a new WD Black 2 TB.. Just reinstalled everything but this time I went back to my beloved Arch Linux, reinstalling Java as we speak to see if I can make it work this time..
X3ME #26
Posted 12 March 2016 - 01:50 PM
New system install, new HDD (!) , original Java and still not working, in no computer in the whole mc world..

im desperate
Edited on 12 March 2016 - 06:31 PM
X3ME #27
Posted 12 March 2016 - 06:05 PM
please, I can't figure this out :/
Lyqyd #28
Posted 12 March 2016 - 07:38 PM
The issue is that the problem appears to only be occurring on your system. Bomb Bloke even downloaded your world and the code worked perfectly fine when run on his system. It runs fine everywhere else, so there's apparently something unique to your system that we're having trouble figuring out.
X3ME #29
Posted 12 March 2016 - 08:21 PM
Hmm… What could it be?

This is so bizarre..

Do you know anyone else who uses CC for linux?

If they try it their system..
Bomb Bloke #30
Posted 13 March 2016 - 01:38 AM
All I can suggest at this point is rigging up a server so that someone can come in and see the issue for themselves.
X3ME #31
Posted 13 March 2016 - 09:19 AM
Im going to set up the server now, will give the link asap
X3ME #32
Posted 18 March 2016 - 10:54 PM
Dude.. I just tried this on a completely different computer using Windows 10…
SAME ERROR
Lyqyd #33
Posted 19 March 2016 - 12:25 AM
You still haven't set up a server to allow others to experiment with the issue.
TYKUHN2 #34
Posted 19 March 2016 - 12:37 AM
Seems like a stupid question but what CC Version are you using?

I can't remember why but I suspected 1.65 (still works on there)
Edited on 18 March 2016 - 11:37 PM
X3ME #35
Posted 19 March 2016 - 12:41 AM
I can't setup the server, I am too dumb to do that, will someone help me out?
Its 1.74

*Setups HTTP Apache Servers with his hands tied yet can't setup a minecraft server*

*Makes asm based operating systems yet, can't setup a minecraft server xd*
TYKUHN2 #36
Posted 19 March 2016 - 01:25 AM
A test that is more than likely redundant.

Before the erroring line type in and tell us the output

print(textutils.serialize(t))

Also replace os.pullEvent with

{"monitor_touch", "top", 9, 10}

It will emulate a touch to bypass os.pullEvent
Edited on 19 March 2016 - 12:30 AM
Lupus590 #37
Posted 19 March 2016 - 12:35 PM
I can't setup the server, I am too dumb to do that, will someone help me out?
Its 1.74
  • download forge for MC 1.7.10: http://files.minecraftforge.net/
  • run the installer and select the server version (tell it to place it's stuff on your desktop or something)
  • run the server jar file (it will complain about a load of missing files, don't worry it's making them)
  • close the server (type "stop" into server window)
  • add computercraft to the servers' mods folder (you can either download this again or copy the one from your client; the server's mods folder should be next to the jar file you used to start it - if there is no mods folder then make it)
  • start the server again and connect to it via your client to make sure everything works
  • you may want to op yourself, in the server window type "op <your MC username>" (you can now use server commands from your client by using a / )
  • port forward this port: 25565 (I'm assuming you know how to do this from your Apache servers)
  • post your IP address here so we can connect (you could also use something like http://www.noip.com/ )
EDIT: added note for if mods folder doesn't exist when adding mod to server
EDIT: make sure to use correct version of forge
Edited on 20 March 2016 - 09:08 PM
X3ME #38
Posted 20 March 2016 - 09:37 PM
Yeah I know that last two steps from setting up apache servers.

I'll do this asap.
Lupus590 #39
Posted 20 March 2016 - 10:08 PM
Just noticed that you said that you are using CC 1.74

Why are you using that when you could use 1.75 which is the latest CC for MC 1.7.10?
Edited on 20 March 2016 - 09:09 PM
X3ME #40
Posted 20 March 2016 - 11:21 PM
Because its the one in the modpack im using…
Lupus590 #41
Posted 21 March 2016 - 10:20 PM


How's the server going?
Edited on 21 March 2016 - 09:21 PM
X3ME #42
Posted 26 March 2016 - 07:22 PM
Sorry I never set the server up, but there is a reason though.
I came to the conclusion its Tekkit Legends fault..
Try it for your selfs, the modpack gives a ton of errors with CC.
On other modpacks it works!
Thanks for everything though guys