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

Plastic Alpha [WIP] (OpenPeripheral) - Google Glass in CC!

Started by 1lann, 10 June 2013 - 05:21 PM
1lann #1
Posted 10 June 2013 - 07:21 PM
Plastic Alpha for OpenPeripheral

by Team Plastic


Forward and the Team:
So basically, I got bored again and was playing on Wired's server which is where I found out about OpenPeripheral. Once I found out about terminal glasses, I basically fell in love with it :P/>. So the possibilities were endless and I decided to make something like Google Glass for it, and this is what I ended up with. Also, this was made in 3 days after I fell in love with OpenPeripheral.
  • 1lann - Everything else and the framework
  • Lieudusty - IRL weather app prototype
Screenies:
Here are screenies describing the elements on the home screen and what they do and what it looks like in-game.


(In large gui scale, I normally play in normal)




Features so far:
  • Tells the current weather in-game give that you have a sensor with a world card attached to the computer from OpenCCSensors
  • Tells the time, either IRL or in-game. You can switch by doing $$irl or $$ingame (IRL time powered by http://www.worldweatheronline.com)
  • Has a converter to convert distances, data measurements, ect. from the STANDS4 network. See http:///www.convert.net. Example usage: $$convert 1 kg to lb
  • Can be updated within itself ($$update)
  • Runs in a daemon so you can use shell at the same time, and after quitting plastic you can run it again by using $$start. Note that this can be disabled with a nodaemon parameter
  • Has a built in calculator to do maths, all you need is a = at the front. Ex: $$=12*3^2
  • In case of a really laggy server and where Plastic freezes on it's animations run it with the parameter "lite" to make it run without any animation
  • Weather, you can lookup for anywhere by using $$weather for <city> or $$weather for your weather. (Also powered by http://www.worldweatheronline.com)
  • Time and date lookup by doing $$time for <city> (' ' ' http://www.worldweatheronline.com)
  • Change settings within Plastic with $$settings
Why is there a $$ in front of every command? That's because that's how you pass commands from chat to the computer with the glass bridge. Yes, you run those commands in chat.

What does it require?
First off you'll need the mod: OpenPeripheral and optionally OpenCCSensors for weather information.

You'll need in-game: A computer (Advanced or normal) a terminal glass bridge attached to the computer, and optionally a Sensor with a world sensor card from OpenCCSensors for weather information. Plastic will automatically detect your setup.

If you're too lazy to get the mods, then use the Technic launcher with this modpack URL: http://www.technicpa...and-peripherals. This is actually Wired's server's modpack, and includes the server address in the modpack. So if you want to check out Plastic/mess around with terminal glasses on a server, or just hang out, go ahead and visit Wired's server. I'm on there often. (No whitelist and has MiscPeripherals, OpenPeripherals, OpenCCSensors, Immibis' s Peripherals, NEI and more.)


Download! v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v v

pastebin get 43nHyKXU plastic
http://pastebin.com/43nHyKXU

Note that this is an Alpha and some things won't work perfectly. Plastic does have crash recovery and will write to /plasticLog. Please report all of the errrors, bugs, and glitches you encounter. Also note that to change the options after you have setup Plastic, you'll have to edit /glassOptions. I will make a way to edit the options within glass in the future. Thanks a ton! :D/>

Credits:
Surprsingly, GravityScore wasn't involved in this project XD

Thanks a TONNE to Mikeemoo for all of the time and incredible effort he put in to make OpenPeripheral and OpenCCSensors. Of course without him, this wouldn't have been possible.

Also for the people on Wired2Coffee's server for keeping me… entertained when writing it? Also for Wired2Coffee's server for existing else I would have possibly never knew about Terminal Glasses (I don't check the Peripherals section on the forums D:)

The STANDS4 network for their API for the convert function.
http://www.timeapi.org for the IRL time support
Mk352 for trying to flaw it (then me fixing it)… (Yes I know, it's him)

And thanks to all of the people who made Minecraft/ComputerCraft ect.

I think that's it. Thanks for trying out Plastic! (Yes I know, the name is so cheap XD)
Mikeemoo #2
Posted 10 June 2013 - 07:43 PM
Looks awesome :)/>

Adding some methods into the next release that you'll find handy - the ability to get the width of text and stuff like that.
1lann #3
Posted 10 June 2013 - 08:09 PM
Looks awesome :)/>

Adding some methods into the next release that you'll find handy - the ability to get the width of text and stuff like that.
Thanks and Awesome!
lieudusty #4
Posted 10 June 2013 - 10:17 PM
Cool :P/>
GravityScore #5
Posted 11 June 2013 - 03:50 AM
Epic job 1lann! Mind if I help? :P/>
Engineer #6
Posted 11 June 2013 - 04:02 AM
Awesome!
superaxander #7
Posted 11 June 2013 - 04:49 AM
Nice implementation of open peripheral nice looking offers some great potential

EDIT: I'd like to help!
Tiin57 #8
Posted 11 June 2013 - 10:30 AM
This looks excellent. Good job, 1lann.
H4X0RZ #9
Posted 11 June 2013 - 05:46 PM
I like it very much!
ETHANATOR360 #10
Posted 11 June 2013 - 10:18 PM
looks cool!!
Edited on 11 June 2013 - 08:19 PM
Imque #11
Posted 12 June 2013 - 07:29 AM
Nice, very nice.
TheOddByte #12
Posted 12 June 2013 - 10:13 AM
Looks so awesome!! Gotta get it NOW!
nutcase84 #13
Posted 12 June 2013 - 06:51 PM
Glass is awesome! So is plastic!
wilcomega #14
Posted 13 June 2013 - 07:34 AM
very cool
theoriginalbit #15
Posted 14 June 2013 - 08:54 AM
Wow this is truly amazing! Well done!
Zudo #16
Posted 15 June 2013 - 01:18 AM
Love it!
P.S: Why "Download v v v v etc." ??
Geforce Fan #17
Posted 15 June 2013 - 01:45 AM
Duude post a tutorial on how to do the colors!
theoriginalbit #18
Posted 15 June 2013 - 01:51 AM
Duude post a tutorial on how to do the colors!
The colours are a capability of OpenPeripheral not ComputerCraft. The format is in hexadecimal #ffffff (#RRGGBB) where each pair of two is a number 0-255, just like with colouring in HTML.
1lann #19
Posted 15 June 2013 - 12:44 PM
Love it!
P.S: Why "Download v v v v etc." ??
To make it more visible so people don't get lost trying to find it xD

Duude post a tutorial on how to do the colors!
And yes, like theoriginalbit said. However, I do declare the colors into variables to make them more convenient for me. These are the lines of code I use to store the colors:

	    local gColors = {}
	    gColors.red = 0xff3333
	    gColors.blue = 0x7dd2e4
	    gColors.yellow = 0xffff4d
	    gColors.green = 0x4dff4d
	    gColors.gray = 0xe0e0e0
	    gColors.textGray = 0x676767
	    gColors.text = 0x5a5a5a
	    gColors.rain = 0x2e679f
Geforce Fan #20
Posted 15 June 2013 - 02:51 PM
So, since I don't know how to do those kinds of colors, could I use the same colors you use in my own OpenPeripheral programs?

It says you can do what you want with the code inside the code.
Lol, I'm going to make my own "plastic". Better watch out, a competitor will soon be competing! :P/>
1lann #21
Posted 22 June 2013 - 06:37 PM
Alright, I updated plastic to v0.1 beta.

Changes:
  • Weather, you can lookup for anywhere by using $$weather for <city> or $$weather for your weather.
  • Time and date lookup by doing $$time for <city>
  • Change settings within Plastic with $$settings
  • Lots of tweaks and bug fixes ect.
theoriginalbit #22
Posted 22 June 2013 - 07:45 PM
Tells the time, either IRL or in-game. You can switch by doing $$irl or $$ingame
Just curious here, why did you choose `$$irl` and `$$ingame` why not have them similar and do `$$irl` and `$$igl`
1lann #23
Posted 22 June 2013 - 11:55 PM
Tells the time, either IRL or in-game. You can switch by doing $$irl or $$ingame
Just curious here, why did you choose `$$irl` and `$$ingame` why not have them similar and do `$$irl` and `$$igl`
Oh, wasn't aware of igl :P/> sure I'll do that
theoriginalbit #24
Posted 23 June 2013 - 12:02 AM
Oh, wasn't aware of igl :P/> sure I'll do that
Well igl isn't a real thing like irl… it just made sense to me to have them similar looking.
jesusthekiller #25
Posted 24 June 2013 - 02:47 PM
Wondering for some time:
Why something like this is so long? D:
Anon10W1z #26
Posted 01 August 2013 - 02:01 PM
Sorry to bump, but how do you input on this?

EDIT: I figured it out. But how do you use the world sensor card?


EDIT2: I figured that out too. For others wondering, I had to use the back side of the computer for the sensor and the left side for the bridge.
PappleFruit #27
Posted 01 August 2013 - 03:58 PM
Man, this thing is awesome! Really like it, thanks for making it! :D/>
However, I think it would be cool, if you could see the time and the weather on the same screen, without having to type in a command to see the weather.
Symmetryc #28
Posted 01 August 2013 - 04:36 PM
Oh, wasn't aware of igl :P/> sure I'll do that
Well igl isn't a real thing like irl… it just made sense to me to have them similar looking.
Then maybe $$real and $$game? A bit longer but it also makes a bit more sense. I'm not really sure.
Bloque #29
Posted 02 August 2013 - 02:43 AM
Hey, I just tried this out and let me say it was AWESOME. I mean, it completely blew my mind how something like this was possible in Minecraft, it really proves that the game has almost no limits (with mods installed, of course.) However, I was wondering if there would be a way that I could have it give me a message on my HUD when the computer running it gets a redstone signal. Is it possible for me to splice some code in to do that? Thank you.
Kamefrede #30
Posted 03 August 2013 - 08:55 AM
My first reaction to this topic: Impossible,then i downloaded the program and runned it and i got stunned, btw on 1.6.2 the terminal glass bridge is called glassesbridge so i had to manually edit it, i dont know if you already know that or not :D/>
lifewcody #31
Posted 03 August 2013 - 11:37 AM
This is my fav program!!!
Anon10W1z #32
Posted 03 August 2013 - 02:41 PM
Hello 1lann,

I accidentally destroyed my ComputerCraft "igl" computer and I had to setup my computer again. I breezed through the setup of the glasses until I got to the weather, where even typing in $$New York results in "Invalid city!"

What site do you use for the weather API?
Kamefrede #33
Posted 03 August 2013 - 04:58 PM
I think the world weather api is broken,you should give it a look
Anon10W1z #34
Posted 04 August 2013 - 03:21 PM
I think the world weather api is broken,you should give it a look
Well it's fixed now…it was probably down temporarily.

Also 1lann, I have a bug to report…

If the user accidentally removes the world sensor card while Plastic is running, then Plastic says it crashes, and it says this in /plasticLog:


parallel:22: Glass:1044: attempt to index ? (a nil value)
TheDawgMiner #35
Posted 05 August 2013 - 04:49 AM
  • "Tells the current weather in-game give that you have a sensor with a world card attached to the computer from OpenCCSensor"
please don't take wrong but have you ever seen a "Redneck Weather Station"
its a dark colored rock sittin' out in the open
if its wet it's raining
if it's white it's snowing


if its missin' it was stolen!!

Awesome concept but can't see a pratical use in MC as you can pretty much tell the weather clear to bedrock if your speakers are on except snow but then F3 will tell ya if your in snow type biome and you can pretty much bet it is lol

would love to see what else you can make though it looks awesome!!!
1lann #36
Posted 07 August 2013 - 07:33 PM
Oh yes for some reason, I think someone is spamming API requests, or it's just Plastic… Because I've been getting a lot of over quota limit warnings for the API. I'll change it soon so it only needs to update every hour instead of minute.

  • "Tells the current weather in-game give that you have a sensor with a world card attached to the computer from OpenCCSensor"
please don't take wrong but have you ever seen a "Redneck Weather Station"
its a dark colored rock sittin' out in the open
if its wet it's raining
if it's white it's snowing


if its missin' it was stolen!!

Awesome concept but can't see a pratical use in MC as you can pretty much tell the weather clear to bedrock if your speakers are on except snow but then F3 will tell ya if your in snow type biome and you can pretty much bet it is lol

would love to see what else you can make though it looks awesome!!!
Well that's why its optional.
kornichen #37
Posted 08 August 2013 - 09:10 AM
Hello,

first to say is that I LOVE plastic :D/>
but Weather is not working so I cut it out of the code so I can use it. And Weather knows Berlin but it does not know any other German city ;(

And I have read something about creating own commands in source code. Please add this because then I can control the light in my house with glass :D/>


Best Regards,
kornichen

Edit: Weather is now working but I am 500 km away from Berlin and it does not know smaller German cities.

Edit 2: Tip for German people: Replace ä by ae, ü by ue, ö by oe and ß by ss, else it won't find the city and Plastic will crash. (Please fix this bug, but maybe it is not fixable because of ComputerCrafts problems with umlauts. Please fix that dan :D/>)
1lann #38
Posted 15 August 2013 - 04:42 AM
Righthtt sorry for the long wait, I was a bit lazy, I updated it now, the time only updates once every hour (so it can become like 5 minutes off in some cases I suppose… I might change it to 10 minutes if it poses a problem) I didn't test this completely since I can't be bothered to wait for 1 hour. So post any bugs you find :)/>

Also, VERY IMPORTANT. In plastic you MUST enter the command $$update to update it. And please update it I'm getting lots of over usage emails of the weather/time API.

the make your own app system (root) works now, heres an example app that is to be placed in the folder /plasticApps

--[[Plastic Root App]]--
--NAME: Example App
if cmd == "hello" then
  centerText("Success",secondText)
  return true
end
Note that return true is necessary to tell Plastic that the command was valid

To run Plastic with root just simply run it with the root argument.

plastic root
Matt-J-222 #39
Posted 20 August 2013 - 07:11 PM
I love this program - it works so well! But i have a question (it may be a really noob-ish question but oh well) i have been looking through your code to try and work out how on earth you get plastic to run in the background and i couldn't find it, if you could give me a quick explanation or a link to one that would be loads of help.
1lann #40
Posted 20 August 2013 - 11:25 PM
I love this program - it works so well! But i have a question (it may be a really noob-ish question but oh well) i have been looking through your code to try and work out how on earth you get plastic to run in the background and i couldn't find it, if you could give me a quick explanation or a link to one that would be loads of help.
You can take a look like this http://www.computercraft.info/forums2/index.php?/topic/2030-tutorial-parallel-api/
Basically I have plastic run in one parallel, and shell in another

local function runShell()
  shell.run("/rom/programs/shell")
end
Matt-J-222 #41
Posted 23 August 2013 - 08:46 AM
Thank you!
DarkEspeon #42
Posted 24 August 2013 - 01:07 AM
lol shellception….. XD it looks amazing….. I need to try making say an os with these cool little things……Might even make a special api for drawing to terminal glasses…. would be quite helpful in the long run… Good job again 1lann!(God you do some cool stuff with CC)
PinYin #43
Posted 06 September 2013 - 02:19 AM
nice!
willwac #44
Posted 06 January 2014 - 10:16 AM
We never got an explination on how the color system works! And, the OpenPeripheral documentation isn't clear on the color format.
GravityScore #45
Posted 06 January 2014 - 10:34 AM
We never got an explination on how the color system works! And, the OpenPeripheral documentation isn't clear on the color format.

The colours are formatted like web hexadecimal colour codes (like #000000 for black, or #ff0000 for red).

There's an explanation on that here.
willwac #46
Posted 06 January 2014 - 10:49 AM
Holy crap! That was the quickest reply I've ever had!
Thanks.
EDIT: Found this:
theoriginalbit said:
function rgbColor( _r, _g, _b )
  return bit.bor( bit.blshift( bit.bor( bit.blshift( _r, 8 ), _g ), 8 ), _b )
end
Edited on 06 January 2014 - 09:54 AM
+Nick #47
Posted 09 January 2014 - 12:58 PM
This inspired me to write my own OpenPeripherals codes! Its really good, and flexible, and does everything really well! :)/>
Whitherunn #48
Posted 02 February 2014 - 04:46 PM
I have my terminal bridge to the left of my computer and have the linked glasses on my head. I also have a wireless modem on the top of the computer. When I type plastic, it says "Could not find Glass Bridge!"
theocat123 #49
Posted 08 March 2014 - 01:24 AM
So I put the code in and it says that it "could not find Glass Bridge!" I have the glass bridge on the left side of my basic computer. Anyone know a solution to this?
CometWolf #50
Posted 08 March 2014 - 11:25 AM
This program is outdated guys, the peirpheral name for the terminal bridge has been changed. Don't bother fixing it though, there's a lot of other method changes aswell.
Jnick22 #51
Posted 20 March 2014 - 09:32 AM
Does anyone plan on continuing this? This seems like an amazing project. And, perhaps, combine it with Cciri?
1lann #52
Posted 20 March 2014 - 04:53 PM
Since people have been begging me so much, I've updated to support the latest version of OpenPeripherals (Same pastebin link)
Edited on 20 March 2014 - 03:54 PM
mhorn00 #53
Posted 20 June 2014 - 09:22 AM
Im having Problems…
When it asks for my city, it always says "Invalid City!".
I put my key in but Im not sure if I did it right…
can someone help me?
thx
onContentStop #54
Posted 26 June 2014 - 05:49 PM
No matter what city I type in, it says "Invalid city!". Did I do something wrong? HTTP is enabled.
oden the fish #55
Posted 30 June 2014 - 09:58 AM
this looks so cool i want to try it but i keep getting could not find glasses bridge when i try to start it up can anyone help?
Danny #56
Posted 22 July 2014 - 11:02 PM
This is awesome.
Danny #57
Posted 23 July 2014 - 02:56 AM
Do I have permission to make modifications to this? I just want to change the color-scheme up a bit.
1lann #58
Posted 23 July 2014 - 01:34 PM
Do I have permission to make modifications to this? I just want to change the color-scheme up a bit.
Sure, go ahead.
kacpercz99 #59
Posted 30 July 2014 - 03:16 PM
I have an problem with the city setup when i type $$New York or something else it says "Invalid City"
1lann #60
Posted 03 August 2014 - 07:02 AM
I have an problem with the city setup when i type $$New York or something else it says "Invalid City"
Oh yeah, to everyone who has this problem, you need to make sure your HTTP whitelist is set to prefferably "*" or allow "api.worldweatheronline.com/*".
Hexxah24 #61
Posted 12 August 2014 - 02:39 AM
This is not working for me. It just says "Could not find Glass Bridge". Anyone know what I should do?
Rectar2 #62
Posted 13 August 2014 - 09:21 PM
Pretty cool, but the light blue text can be a bit hard to read. You should make the colors changeable.

This is not working for me. It just says "Could not find Glass Bridge". Anyone know what I should do?
This program requires OpenPeripherals, and the Terminal Glasses Block from that mod needs to be placed next to the computer.
Edited on 15 August 2014 - 08:49 PM
TommieIV #63
Posted 14 August 2014 - 09:05 PM
You need to make an appstore. I know that would be time consuming but it could be a "feature for the future "
Anon10W1z #64
Posted 15 August 2014 - 10:29 PM
Doesn't seem to work with the world sensor…
kacpercz99 #65
Posted 18 August 2014 - 01:45 AM
I have an problem with the city setup when i type $$New York or something else it says "Invalid City"
Oh yeah, to everyone who has this problem, you need to make sure your HTTP whitelist is set to prefferably "*" or allow "api.worldweatheronline.com/*".
It worked but now i got "Plastic has crashed and will now restart see /plasticLog for more information" and the plasticlog is not working " bios:366: [string "plasticlog"]:2: '<name>' expected
theoriginalbit #66
Posted 18 August 2014 - 01:57 AM
you're meant to open the log in the edit program, it is not a self contained program. simply run edit plasticlog
robbie0630 #67
Posted 24 August 2014 - 03:04 AM
Hey, discovered a bug:
I tried to set my city for weather and time, and even with the example ($$New York) it still said invalid city. Please help.
theoriginalbit #68
Posted 24 August 2014 - 03:29 AM
Hey, discovered a bug:
I tried to set my city for weather and time, and even with the example ($$New York) it still said invalid city. Please help.
Oh yeah, to everyone who has this problem, you need to make sure your HTTP whitelist is set to prefferably "*" or allow "api.worldweatheronline.com/*".
utybo #69
Posted 21 February 2015 - 12:52 PM
I updated this program so that it uses the sync() method. If it is not used, the gui will not show up !
Available here : http://pastebin.com/rbnyLdrZ
Download it to your computer through this command :

pastebin get rbnyLdrZ utybosplastic

EDIT : It was removed from Pastebin for some unknown and mysterious reasons. I will re-upload it ASAP.
Edited on 22 February 2015 - 04:22 PM
Eltie905 #70
Posted 20 March 2015 - 11:28 PM
Alright, I updated plastic to v0.1 beta.

Changes:
  • Weather, you can lookup for anywhere by using $$weather for <city> or $$weather for your weather.
  • Time and date lookup by doing $$time for <city>
  • Change settings within Plastic with $$settings
  • Lots of tweaks and bug fixes ect.
When ever I start the program it says I don't have a bridge attached and I have one attached.
Please help. :(/>
Uncertified Robot #71
Posted 25 March 2015 - 09:04 AM
For anyone getting an error that there's no bridge attached:
Edit line 35 and change "openperipheral_glassesbridge" to "openperipheral_bridge"
powerlego #72
Posted 26 October 2015 - 02:31 AM
I found a bug with the program
It won't run and the plasticLog says this

plastic:239: attempt to call nil
Lupus590 #73
Posted 26 October 2015 - 11:34 AM
I found a bug with the program
It won't run and the plasticLog says this

plastic:239: attempt to call nil

the function called on line 239 doesn't exist