Touchpoint API
#41
Posted 21 May 2014 - 12:53 AM
#42
Posted 21 May 2014 - 02:12 AM
#43
Posted 27 May 2014 - 09:47 AM
First thanks for the very nice tutorials. They for sure help me a lot getting into CC and LUA.
I have tried your example and it does not work for me.
- I have put a computer down
- Added a screen to the top
- Downloaded the touchpoint script
- Made a script with you example code
After testing it exits after/at this code:
Quote
The monitor looks like this after program run:
http://dl.dropboxuse...assorted/cc.png
I use MC: 1.7.2 and CC: 1.64pr2
What am i missing?
/sEi
#44
Posted 27 May 2014 - 09:43 PM
sEi, on 27 May 2014 - 09:47 AM, said:
First thanks for the very nice tutorials. They for sure help me a lot getting into CC and LUA.
I have tried your example and it does not work for me.
- I have put a computer down
- Added a screen to the top
- Downloaded the touchpoint script
- Made a script with you example code
After testing it exits after/at this code:
Quote
The monitor looks like this after program run:
http://dl.dropboxuse...assorted/cc.png
I use MC: 1.7.2 and CC: 1.64pr2
What am i missing?
/sEi
CC 1.6 changed the term api. In the draw function, it ends with "term.restore()" which is no longer valid.
Try this
draw = function(self) local prevTerm = term.redirect(self.mon) term.setTextColor(colors.white) term.setBackgroundColor(colors.black) term.clear() for name, buttonData in pairs(self.buttonList) do if buttonData.active then term.setBackgroundColor(buttonData.activeColor) else term.setBackgroundColor(buttonData.inactiveColor) end for i = buttonData.yMin, buttonData.yMax do term.setCursorPos(buttonData.xMin, i) term.write(buttonData.label[i - buttonData.yMin + 1]) end end term.redirect(prevTerm) end
#45
Posted 28 May 2014 - 10:50 AM
McLeopold, on 27 May 2014 - 09:43 PM, said:
CC 1.6 changed the term api. In the draw function, it ends with "term.restore()" which is no longer valid.
Try this
draw = function(self) local prevTerm = term.redirect(self.mon) term.setTextColor(colors.white) term.setBackgroundColor(colors.black) term.clear() for name, buttonData in pairs(self.buttonList) do if buttonData.active then term.setBackgroundColor(buttonData.activeColor) else term.setBackgroundColor(buttonData.inactiveColor) end for i = buttonData.yMin, buttonData.yMax do term.setCursorPos(buttonData.xMin, i) term.write(buttonData.label[i - buttonData.yMin + 1]) end end term.redirect(prevTerm) end
That did the trick! - Now it works.
Thank you McLeopold for taking the time to help, it is much appreciated! <3
/sEi
#46
Posted 02 June 2014 - 10:21 PM
I saw the thing about the pages of buttons and decided to try it out for menus.
So I reprogrammed my control program from my terminal control to this, and ran into a problem.
The script is right here: http://pastebin.com/PmbKjbA0
The problem is on line 169 (highlighted), it will print the first line, "new1". After that it gives an error and doesn't print "new2" which is right after the table, and I'm unsure about what I am doing wrong here.
The error is:
touchpoint:104: attempt to index ? (a nil value)
I'm not that good with programming, and I looked into your code but couldn't quite figure it out. Any help is appreciated, thank you in advance!
EDIT: Something important I forgot, I am using CC 1.5
Edited by Bmandk, 02 June 2014 - 11:26 PM.
#47
Posted 02 June 2014 - 11:51 PM
#48
Posted 03 June 2014 - 12:02 AM
#49
Posted 03 June 2014 - 12:45 AM
func(args)
you'd do this:
function() func(args) end
Another issue is that your changePage function won't work as written, as it will always try to change the page to pages.page (which doesn't exist). You should change it to pages[page] and put quotes around the strings you are passing in to it, so changePage("mainMenu"), for instance.
#50
Posted 03 June 2014 - 06:15 AM
As for the pages.page, I did have it as pages[page] first, I just tried to test it out and wanted to change it back, but must've forgotten. Thanks!
#51
Posted 16 June 2014 - 02:33 AM
I am trying to set a button to run an external program to update all the pastebin code associated with the system. I'm tired of quitting the main program and running it by hand and then restarting. So I set a button to run a function that calls out and reboots the computer.
local touch = touchpoint.new("left") touch:add("Progression", nil, 2, 2, 16, 6, colors.blue, colors.lightblue) touch:add("Upgrade", upgradeReboot, 56, 13, 69, 17, colors.blue, colors.lightblue) -- Upgrade System Files and Reboot function upgradeReboot() touch:toggleButton("Upgrade") --mlapi.tp writes the text to the terminal at location x,y and in specified colours mlapi.tp("Downloading & Upgrading...standby.", 19, 17, colors.white, colors.red) shell.run("update") os.reboot() end -- MAINLINE while true do --mlapi.clear is what I use to clear the monitor screen) mlapi.clear() touch:draw() --tppi.title is the function to draw the logo tppi.title(21, 6) touch:run() end
I believe this is working, however when it re-runs the system from startup, I can no longer click on anything. Not sure why this is happening since the entire computer is rebooting?
#52
Posted 16 June 2014 - 02:57 AM
#53
Posted 16 June 2014 - 04:07 AM
Lyqyd, on 16 June 2014 - 02:57 AM, said:
The server is running TPPI modpack v1.0.1, which has CC 1.58. No other computers connected to the monitor. Startup runs the program, it isn't startup. I even renamed startup so it wouldn't run when I selected the button, and it does appear to work, however after it comes back from the reboot, and I run start again, the buttons are not selectable. If I break the program and run it again, they seem fine. It's weird.
START(UP) Program: term.clear() local monitor = peripheral.wrap("left") monitor.setCursorPos(0, 0) monitor.setTextColor(colors.white) monitor.setBackgroundColor(colors.black) monitor.clear() -- mulambda165 is the actual program. shell.run("mulambda165")
Edited by mckerrnel, 16 June 2014 - 04:09 AM.
#54
Posted 16 June 2014 - 04:39 AM
#55
Posted 16 June 2014 - 04:50 AM
#56
Posted 17 June 2014 - 04:24 AM
http://i.imgur.com/uJZ734v.png
Any help? Thanks!
#57
Posted 17 June 2014 - 04:29 AM
It's the weirdest thing. Every OTHER time I run it, it works fine. If It reboots after clicking, it won't let me click anymore. If I break it without clicking and then run it again, it won't let me click. Breaking again and running again works fine.
#58
Posted 17 June 2014 - 05:46 AM
mckerrnel, on 17 June 2014 - 04:29 AM, said:
It's the weirdest thing. Every OTHER time I run it, it works fine. If It reboots after clicking, it won't let me click anymore. If I break it without clicking and then run it again, it won't let me click. Breaking again and running again works fine.
That is indeed very weird, and I don't think the problem is in Touchpoint at that point. I'm really not sure which way to point you at this point.
If you're feeling adventurous, could you set up a startup program that will print every event it receives and try clicking around on the monitor after a reboot?
howdanrocks, on 17 June 2014 - 04:24 AM, said:
http://i.imgur.com/uJZ734v.png
Any help? Thanks!
That looks like it's trying to print an error message. Which version of ComputerCraft are you on?
Edit: If you were using 1.6+, try the new version. There was a compatibility issue that I thought I had fixed, but apparently had not yet done so. I just updated the pastebin, so use the link in the first post to get the updated version.
#59
Posted 09 July 2014 - 10:15 AM
#60
Posted 09 July 2014 - 07:36 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users