Jump to content




Touchpoint API


  • You cannot reply to this topic
277 replies to this topic

#81 xxxzzzmark

  • New Members
  • 1 posts

Posted 02 January 2015 - 09:17 PM

Can we get something that returns a bool like isActive("name") which will return if true if the button is active?

#82 plague006

  • Members
  • 4 posts

Posted 05 January 2015 - 07:06 PM

Love the API and have used it in a bunch of projects.

I have a small suggestion that would save me effort every time I use the API though: allowing "duration" to be sent as an optional argument to the flash function. I find the pulse too quick for a lot of my cases and while modifying the API per-install isn't a big burden, it would be nice to have the functionality built in.

Thanks for a great API regardless!

#83 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 January 2015 - 07:40 PM

Yes, an optional duration argument isn't a bad idea.

Edit: I've added this feature. An optional duration argument may now be specified. If it isn't, the default will be used.

#84 plague006

  • Members
  • 4 posts

Posted 05 January 2015 - 09:41 PM

View PostLyqyd, on 05 January 2015 - 07:40 PM, said:

Yes, an optional duration argument isn't a bad idea.

Edit: I've added this feature. An optional duration argument may now be specified. If it isn't, the default will be used.

I certainly didn't expect it to be implemented within an hour, lol. Thanks much.

#85 Tekzi

  • New Members
  • 1 posts

Posted 09 January 2015 - 03:08 AM

I'm just curious if something about the code would have been broken by running the server on Java 8 update 25? I just switched my server over from Java 7 to 8 and everything else seems to be working all right except none of the monitors are responding to touch anymore. To be fair I love touchpoint so much if it is the case I might just downgrade Java back to 7 to keep it around. Thanks.

#86 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 January 2015 - 03:42 AM

That shouldn't have broken anything, but if it really isn't working, you might make sure that you're able to get monitor_touch events at all. The Java version shouldn't make a difference for monitors.

#87 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 January 2015 - 03:56 AM

I've just added a long-requested feature, the ability to use Touchpoint on terminals as well as monitors. Simply do not specify a side when calling touchpoint.new() and the returned instance will use the current terminal instead of a monitor. This feature is only available in ComputerCraft 1.6 or later, as term.current() did not exist prior to that version. Attempting to use this feature on previous versions will cause Touchpoint to crash.

#88 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 21 January 2015 - 07:40 AM

Any particular reason you can't just point to term if term.current() isn't present?

#89 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 21 January 2015 - 04:24 PM

Well, the only other option at that point would be term.native, which can be undesirable. Pointing it at term means it would follow all of the redirects, whereas the implementation as it stands now can ignore the current redirection and always draw to the same place. As well, term would involve changing the draw function to not redirect at all if using term itself. I'm not a huge fan of the idea, though I suppose allowing term.native on older versions of CC might not be too awfully bad, since it at least predates multishell. I'll think about it further. Thanks for the question!

#90 GenesisOfTheVoid

  • Members
  • 8 posts

Posted 31 January 2015 - 10:28 AM

Thanks Lyqyd! Great API

#91 Salox

  • New Members
  • 2 posts

Posted 11 February 2015 - 05:12 PM

OK first lest me state i'm a noob to CC i only recycle projects people have posted (with some basic editing). I used touchpoint api for a portal set up (ref: https://www.youtube....ab_channel=Fako) and have run into issues with other then my self being able to use the portal. The portal set up was done while i was op'd. Is there any suggestions to fix this issues of modifications that could be made to fix this issue. BTW i plan on using this "set up" as the servers spawn portal.

#92 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 February 2015 - 05:43 PM

There isn't anything in Touchpoint (or ComputerCraft, with the exception of the brand-new Command Computers) that would prevent a program that works for one player from working for any other players. Does your server have any protection plugins that prevent players from interacting with blocks in spawn? I know the built-in spawn protection mechanism prevents access to chests and such, though I haven't tested it on monitors or computers. You may have to move the monitor and computer outside of spawn if turning off spawn protection isn't an option.

#93 Salox

  • New Members
  • 2 posts

Posted 12 February 2015 - 04:59 PM

It was the spawn protection that was restricting access to the monitor. thank you for your help. (down side to having more then one server dev/admin some times fining simple problems isn't so simple)

#94 comp500

  • Members
  • 66 posts

Posted 19 February 2015 - 10:24 AM

One suggestion:
for t:run(), could there be a variable (like in javascript) that is passed to the function and gives details of the event.
eg.
function button(e)
if e.label = "1" then
...
t:add("1", button, ...)
t:add("2", button, ...)
t:run()
I am making a keypad (currently with dw20's api, just about to port it to your api) and I would like to have buttons 1-9 without 9 functions...
I know it is possible to do it with the event thing, but t:run() is cleaner...

on a side note, would I be able to put this api in a github repository, I'd credit you... https://github.com/comp500/CCSnippets/

Edited by comp500, 19 February 2015 - 10:36 AM.


#95 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 20 February 2015 - 01:17 AM

Well, you could assign your buttons' functions like so:

function button(num)
  if num == 1 then
    --# etc.
  end
end

t:add("1", function() button(1) end, ...)

I hadn't realized I had forgotten to actually put Touchpoint on github, It's there now, and since it is under the MIT license, you are of course free to fork it or do whatever else you like within the limits of the license.

#96 comp500

  • Members
  • 66 posts

Posted 20 February 2015 - 07:38 AM

View PostLyqyd, on 20 February 2015 - 01:17 AM, said:

Well, you could assign your buttons' functions like so:

function button(num)
  if num == 1 then
	--# etc.
  end
end

t:add("1", function() button(1) end, ...)

I hadn't realized I had forgotten to actually put Touchpoint on github, It's there now, and since it is under the MIT license, you are of course free to fork it or do whatever else you like within the limits of the license.
Nice! I will probably use my own event loop anyway, because I need to listen for redstone events (a button to open the door from behind).

Good, I'll might fork it and add some stuff. I use the MIT license on my CC stuff as well.

PS: It's so strange on this forum, because I'm in the UK so nobody really is on when I'm on, so I have to wait until the next day

#97 Lupus590

  • Members
  • 2,028 posts
  • LocationUK

Posted 29 March 2015 - 02:52 PM

For your statistics, I am now using touchpoint in my hive project

#98 Brod8362

  • Members
  • 45 posts

Posted 29 March 2015 - 06:55 PM

Would there be a way to use this on a pocket computer? Ive been writing a portable program which could utilize it and it would be nice to know if I could use this instead of doing it manually.
Thanks!

#99 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 29 March 2015 - 07:54 PM

You can create a touchpoint instance that uses the current display with just:

local t = touchpoint.new()

You then can use the instance like you would any other Touchpoint instance.

#100 MechTech

  • New Members
  • 1 posts

Posted 07 April 2015 - 04:05 PM

Hello I am sorry to bother you but I wanted to try your api, but I am not necessarily the best coder in the world :P
All I ask of you is to make me a small program with guidelines that will help me understand this API a bit better.
could you write me just a simple program (2 buttons that emit a redstone signal left and right) and help me understand it a little better?
Thanks.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users