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

Tips to a cool program

Started by Writer, 15 January 2015 - 05:37 PM
Writer #1
Posted 15 January 2015 - 06:37 PM
I'm making an utility program that will allow me to control my base at distance with the Terminal Glasses from OpenPeripherals and the ChatBox from MoarPeripherals. The problem is that I have a limited space to work with and my idea to save space is to enable the glasses if a moving point hovers over a certain area (I saw it in this video: https://www.youtube.com/watch?v=eqtLcN3v1Rs). Now, this video is kinda old and I don't know if it is possible to do anymore. My first question is it possible? My second question is if it is possible to get rid, somehow, of the inventory/XP/health/food/etc bars with something.
Lignum #2
Posted 15 January 2015 - 07:19 PM
Taken from the description of that video:
"This is a basic API which adds mouse functionality to your terminal glasses from OpenPeripheral. It works using an OpenCCSensor that gets your yaw and pitch, and then converts that into X/Y screen coordinates."
So I suggest you use that guy's API. That's the simplest way to do it.
Writer #3
Posted 15 January 2015 - 08:11 PM
Still, I just wanna know if there is a way to do without the ccsensor. I could use the API, but if there was a better way, I don't really mind to to an entire API from scratch.
KingofGamesYami #4
Posted 15 January 2015 - 08:30 PM
No, you need either that sensor or a sensor that provides the same functions. It's amazing he was able to do that at all, in my opinion.
Writer #5
Posted 15 January 2015 - 09:05 PM
That is a shame. I will then have to use the moar peripherals to do this task (it will be easier, I think) cause I think there is a range limit. And yes, indeed it is amazing how he did! BTW, is it possible to eliminate the minecraft bars (like health, hunger, xp, etc)?
Lemmmy #6
Posted 15 January 2015 - 09:32 PM
That is a shame. I will then have to use the moar peripherals to do this task (it will be easier, I think) cause I think there is a range limit. And yes, indeed it is amazing how he did! BTW, is it possible to eliminate the minecraft bars (like health, hunger, xp, etc)?

I don't think Moar Peripherals can do that. You can also eliminate the bars with use of a client-side mod, but I don't think there's a peripheral for it. You'll just have to work with the range limit, or use a Pocket PC.
Writer #7
Posted 15 January 2015 - 09:49 PM
No, with the moar peripherals I will be able to digit a code and it will execute it. Nothing to do with range or mouse position. About the bars, well then. Looks like there won't be 2 mods in the modpack I'm playing (they really weren't necessary, they were just there when I installed the modpack).
Bomb Bloke #8
Posted 15 January 2015 - 11:13 PM
I don't think Moar Peripherals can do that.

I reckon he's talking about the chat box peripherals it offers, which allows two-way communications between players and computers.
Bubba #9
Posted 16 January 2015 - 02:17 AM
Well speaking as the author of that video, it wasn't actually all that difficult. There wasn't even any trig actually. Essentially, all that I did was get the inital yaw/pitch of the player, store it in a variable, and then loop and get their new yaw/pitch. Then all you have to do is take the amount that the yaw/pitch has changed and multiply that by some "scaling factor" (which is essentially the mouse speed). The API itself is only 108 lines long, and most of that is boiler-plate code required to interpret the sensor data.

I think your best option here would definitely be to use the ChatBox. You'll probably find that commands are quicker/easier to use anyway, particularly given that you won't be restricted to a small radius of the sensor. That was a really fun/neat little project, but it's just not practical for most purposes. If one day OpenPeripheral comes out with a way to get your screen size and detect player pitch/yaw without respect to distance, then it would definitely be more feasible. Or maybe now that I'm getting back into modding I'll make a mod that can do something similar myself :)/>

Anyway, if you do happen to use my API, you'll probably have to change things up a little to interpret the sensor data (or so I've been told). I think OpenPeripheral has changed how it works/sends events. Let me know if you do change it, I'll link the new version from the video.
Edited on 16 January 2015 - 01:19 AM
Writer #10
Posted 16 January 2015 - 04:17 PM
Thank you so much! Although your API is really cool, right now I kinda changed my mind. What I wanted was something like Google Glasses, with a menu where you selected what you want with, in this case, your mouse, but I already found a new way to do the thing. I may then post the code when I'm done. :)/>