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

Glass I V0.3.3 - Google Glass In Computercraft, Currently recoding!

Started by Geforce Fan, 15 July 2013 - 04:06 PM
Geforce Fan #1
Posted 15 July 2013 - 06:06 PM
I've done some thinking, and considering every time I add something or change something, 9,001 bugs get in the code, it's time for a recode of Glass. Tons of functions are noobishly coded, inefficient, laggy, confusing, and messy. Even trying to support different GUI scales is a huge issue, and even the clock on the home screen is noobishly coded and just lags down glass entirely. And at this point, I don't even want to code the current Glass just because of how stressful and messy it is. This time it will be different. I will add orginization to the code, more logicial code, won't make another pixel API(because that was just dead weight on the code, caused lag, added metric craploads of invisible shapes(that would turn visible when you used them) onto glass and was generally useless) and will generally make glass work well. I will keep the old glass up and will link a topic to the new post when I make the new glass and get the topic up. Feel free to do whatever you want to this version of glass. Mod it in any way, and you don't need to give me credit. At all(though it would be appreciated).

OLD POST:

Requires OpenPeripheral to work!
Install:
On a BASIC computer with a Terminal Glass Bridge next to it, run

pastebin get  yJgWrGpY installer
OR, if you have already installed glass, at the home screen, do
$$options
Then go to update. It should automaticly update. IF it does not, you can manually update glass the same way you installed it the very first time :)/>/>
ImagesGlass's Home Screen:

Very first, buggy test of the Pixel API(well, atleast running the first test program anyhow):

V0.3[currently in public beta]'s theme changer example:

PUUUUURRRPPPLEEEE!!!!

if you want to edit the main code, you'll need my permission.

APIs and common variablesglass - The variable wrapped to the peripheral
tinyPrint("text", line, color) - prints up to 5 lines of text on the screen, like in help. Line can be 1-5
highPrint("text") - Prints texts in red like in the home screen, where it says "Welcome username!"
midPrint("text") - Prints text in green like in the home screen, where it says "Glass V0.0001"
lowPrint("text") - Prints text in light blue like in the home screen, where it says "Do $$help for help."
tinyClear() - Clears Tiny Text
bigClear() - Clears Big text(highPrint, midPrint and lowPrint text.)
bigBox - The gray box where text is printed.
loadPixelAPI - Loads the pixel API. Is called by default.
drawPixel(x,y,color,transparency) - Draws a pixel on the glass screen. Note that the Z index is 4, and text's Z index is 5.
pixelClear() - Clears all pixels on the screen. In the background this actually makes them completely transparent, but you don't need to worry about that.
var = rgbColor( r,g,b ) - Converts RGB colors to work with Terminal Glasses, and sets the converted color to var. All credit to TheOriginalBit for making this one!
ALSO: For Glass to able to launch your application it need to put in in the folder CCGlass/

Feature plansApp store - Eventually
Book app & Book Store - Eventually
0.5 sized text to fit 10 lines - In a few versions, maybe the next one
Easier recoloring of highPrint, midPrint, and lowPrint - Eventually
Default Games - Eventually
In-Glass App Editor - Eventually, but probably won't be the most featured editor out there. If anyone wants to make a 3rd party application that does this, I'll put it in instead, with your permission of corse. I'll give you credit, don't worry ;D
"lua" program - Maybe
Running Plastic and Glass on the same computer, same terminal glasses - Maybe. I'll probably just have Glass be able to do the same things that Plastic can do.

Known Bugs
  1. Does not work if the chunk with the computer hosting Glass is not loaded - Pretty sure this is an OpenPeripheral bug.
  2. After quitting an application that uses the pixel API, pixels are not cleared. Fixed in V3.0BETA1
  3. Doesn't react nicely to lag - Typicly only on SMP Openperipheral bug.
  4. Gets a real error when you call error() - Won't try to fix, just letting you know that's why it's giving you errors when you use error() Fixed while fixing another bug
  5. When updating, Glass will totally flip out and the launcher will spam errors and keep trying to relaunch glass. Has existed since 3.2, so you can still use the updater of 3.0BETA1 Fixed, however, not counted as a new version. Re-run the installer to get this fix, your settings nor apps will not be overrided.
  6. The launcher will not display the error message. -This has been fixed in my dev version, however if you want to have this feature now, at the section of the code where it has the GUI parts, where the if statement is change
     if goodShutdown then
    To
     if not goodShutdown then
    .
What to expect in the next version
  • A smaller print function that fits 10 lines onto Glass(done, it's like 10x more efficient then tinyPrint's code, too!)
  • Books(currently working on)
  • Book "store"
  • Options(already done, this one's guaranteed)
  • An updater(Already done, located in Options
  • Useful stuff
  • Bugfixez
What's New?V0.3.3
Spoiler
  • GUI for when you $$sleep glass
  • Better opening GUI
  • Closing GUI
  • Launcher fixes
  • Update notifier
  • Patched "update" in options
  • Removed herobrine

V0.3.2(old)
SpoilerThis version adds Goroutines, an API by GopherAlt, displays the live-updating time at the home screen, and adds a launcher that will relaunch Glass if it crashes. You will need to launch glass by running "Launch". If you want to update to this version from 3.0BETA1, go options, then update.



Version V0.2.1
Spoiler
  • Added pixelClear()
  • Fixed the bug where the bridge ALWAYS had to be on the left side
  • Redid the versioning system
Version V0.2

Spoiler
  • Added Pixel API
  • Added "Garbage Collectors" that set variables to nil at the end of functions if they're not needed elsewhere.
Version 0.1
SpoilerInitial Release


Credits: Me(Hithere__): Making Glass
GopherAlt: Making Goroutines
Mikeemoo: Making OpenPeripheral
Dan2000: Making Computercraft

Tips & Tricks
  1. Change the transparency in options to 0 to make only the text appear
  2. Create your own themes by editing glassTheme
  3. Set launch to your startup to launch glass automajikly
  4. In the help menu, go to index($$index) to see all available commands in help
  5. If you don't want Glass on your screen, at the home menu, do $$sleep and it will quit displaying until you do $$wake.
  6. When messing with settings, do $$reboot at the home screen for changes to take place
  7. At the home screen do $$shutdown to do an errorless shutdown
  8. At the home screen, do $$crash to get an error, and have the launcher relaunch glass
  9. To test lag, do $$ping at the home screen and measure the delay!
  10. You can $$exit help from any help screen
  11. You can update glass from the options menu
  12. You can tell weather you need to update or not by looking at the top text at the home screen. If it says "Update Available" then you need to update. Version V0.3.2 and below does NOT do this.
  13. If glass is stuck in a crash loop, at the red box just do $$shutdown and it will quit relaunching glass and exit the program
  14. $$crash
  15. You can make apps for glass by placing them in the CCGlass/ folder, then launch them by doing $$apps then $$appname. The app name will be the same name as you named it.



See the very first released version of Glass!Do

pastebin get y36ynixL old_glass
This version has been SLIGHTLY modifed so that the latest apps on Glass will not crash. To use options, do $$apps then $$options. You will launch this version by calling "old_glass" and not the launcher.
I've only added some empty functions, and some "placeholder" things, like tinyCPrint, which just tinyPrints things.
The commands help in help will crash glass, and so will update in options. The only usable option is username.
When you shutdown glass, you'll need to do lua, then glass.clear()
By the way: options did not exist in this version. It's rather buggy.
WARNING: Do not go to themes in the old glass options. It will crash your new glass.
Edited on 28 December 2013 - 05:24 PM
Zudo #2
Posted 16 July 2013 - 02:19 PM
The screenies do not work :(/>
nutcase84 #3
Posted 16 July 2013 - 02:21 PM
The screenies do not work :(/>

I can confirm this.
theoriginalbit #4
Posted 16 July 2013 - 02:52 PM
Nice to see you released it :)/> even if it is a build…. V<major>.<minor>.<revision>.<build>

Added "Garbage Collectors" that set variables to nil at the end of functions if they're not needed elsewhere.
Use local variables, when they're no longer referenced LuaJ will get Java's GC onto them and destroy them.

Also this line


print("deleting installer")
shell.run('delete installeralpha')

I would make this

print("deleting installer")
fs.delete( shell.getRunningProgram() )
Just incase the user hasn't named it what you suggested they name it to.
Geforce Fan #5
Posted 16 July 2013 - 03:06 PM
Nice to see you released it :)/> even if it is a build…. V<major>.<minor>.<revision>.<build>

Added "Garbage Collectors" that set variables to nil at the end of functions if they're not needed elsewhere.
Use local variables, when they're no longer referenced LuaJ will get Java's GC onto them and destroy them.

Also this line


print("deleting installer")
shell.run('delete installeralpha')

I would make this

print("deleting installer")
fs.delete( shell.getRunningProgram() )
Just incase the user hasn't named it what you suggested they name it to.
Oh, I didn't know you could get the running program. Also, the installer is sort of just something I threw together in a minute, then patched it to work with v0.0002. But, I will add that later.

Also, I may need to release a v0.00021 to add a much needed function, pixelClear().

Fixed the screenies.
theoriginalbit #6
Posted 16 July 2013 - 04:30 PM
Oh, I didn't know you could get the running program.
You indeed can, you can also figure out the name they called the file …

local name = fs.getName( shell.getRunningProgram() )
… and the path it is in …

local fullPath = shell.getRunningProgram()
local name = fs.getName( fullPath )
local path = fullPath:sub( 1, #fullPath - #name )

Also, I may need to release a v0.00021 to add a much needed function, pixelClear().
Please do tell me, what is the 0.00001 for? In all my experience of programming I've never come across this scheme for a versioning system! The most common seen is major.minor[.build[.revision]].
Geforce Fan #7
Posted 16 July 2013 - 04:49 PM
Oh, I didn't know you could get the running program.
You indeed can, you can also figure out the name they called the file …

local name = fs.getName( shell.getRunningProgram() )
… and the path it is in …

local fullPath = shell.getRunningProgram()
local name = fs.getName( fullPath )
local path = fullPath:sub( 1, #fullPath - #name )

Also, I may need to release a v0.00021 to add a much needed function, pixelClear().
Please do tell me, what is the 0.00001 for? In all my experience of programming I've never come across this scheme for a versioning system! The most common seen is major.minor[.build[.revision]].
basically the 0's sort of resemble it's Alpha. It's not a very common system, though. I'll just change it to 0.2.1 to clear that up.
Geforce Fan #8
Posted 17 July 2013 - 12:39 PM
Hey, anyone know how I should go about finding if a string is too long for tinyPrint then making overhanging words go to the next line?
Edit: Just realized this is my 200th post. Yaaay!
GravityScore #9
Posted 17 July 2013 - 01:05 PM
Hey, anyone know how I should go about finding if a string is too long for tinyPrint then making overhanging words go to the next line?
Edit: Just realized this is my 200th post. Yaaay!

If you can't be bothered splitting it up into words then:

local str = "hello" -- the string to split up
local str2 = "" -- the second line
local maxLen = 20 -- max length the string can be
if str:len() > maxLen then
  str2 = str:sub(maxLen + 1)
  str = str:sub(1, maxLen)
end
Geforce Fan #10
Posted 18 July 2013 - 07:22 PM
never mind, see my post below
Geforce Fan #11
Posted 20 July 2013 - 02:34 PM
While playing on wired's server the answer hit me, I've found a way that tests a bunch of cut-offs until it finds the right length to cut-off! It's based off of GravityScore's method but redone to account for the text not being monospaced.
Eliminator #12
Posted 11 October 2013 - 08:09 PM
$$> doesn't do anything for me.
theoriginalbit #13
Posted 11 October 2013 - 09:34 PM
$$> doesn't do anything for me.
Then you don't have OpenPeripheral installed.
Eliminator #14
Posted 12 October 2013 - 01:24 AM
Um, yes I do, $$help and $$exit work fine, but $$> and $$< do nothing.
TheOddByte #15
Posted 16 October 2013 - 01:16 PM
Haven't tested this program so I can't actually give any feedback, But I would suggest you put in OP what mod/peripheral you need that include terminal glasses since there are alot of people that could get confused and think that it maybe is installed in ComputerCraft or something.
Geforce Fan #16
Posted 17 October 2013 - 06:18 PM
Wooah nice grave-dig guys.
I probably should release a beta now that I think of it. On it!
(and because I'm cheap I'm going to make the launcher automaticly download the beta :D/>)
Edit: I've gotten the beta up but will edit post and others later, out of time right now.
It will crash saying no such program right now, to fix edit glassTheme and put the hexcode 000000 in both vars, like this
bigBoxColor = 000000
Do the same with sideColors, and on the same line &amp; program
kthxbye


Patched the installer. You may still need to go into options and set the theme to default.
Geforce Fan #17
Posted 17 October 2013 - 08:14 PM
Um, yes I do, $$help and $$exit work fine, but $$> and $$< do nothing.
I probably should have a $$list to list commands, but $$> are not used yet, and the list of commands are:
apps
options
sleep
reboot
shutdown
options
In help:
apps, version, index
In options:
Anything that's listed on the screen.
In apps:
The $$[appname] will run the app that is named that name.
————————————————————————————
In the next update I'm probably going to adding Goroutines and some new GUI stuff.
But wow. Glass is starting to turn into spaghetti
Geforce Fan #18
Posted 18 October 2013 - 07:39 PM
Released V0.3.2, this version adds Goroutines, a clock, and a bugged-up launcher that will automajikly relaunch glass if it crashes. You'll need to launch glass now by calling "launch".
Geforce Fan #19
Posted 19 October 2013 - 10:02 PM
Does anyone know weather it would be possible to convert some of an HTML site to lua, then display it using OpenPeripheral's terminal glass boxes system, and just disclude certain HTML stuff that glass cannot display?
Geforce Fan #20
Posted 19 October 2013 - 11:27 PM
In progress of patching installers and uploading Glass V3.3.
It's currently safe to update. Go to options, then update, then do $$y when it aks you if you want to update.
If glass starts freaking out, you will need to download the installer off pastebin and run it manually. This means you have downloaded glass before I patched options, and when you update you will get the patched options.
NEW FEATURES:
  • Better opening animation
  • Closing animation
  • Launcher patches
  • New help doccument, page, whatever you want to call it
  • Better sleep GUI
  • Checks for updates on launch
  • Probably a lot of other features I'm forgetting to mention.
CRASH COMMAND FTW


We should hold contests to see how long you can play minecraft with that crash dialog/window/box thing
theoriginalbit #21
Posted 20 October 2013 - 01:49 AM
-snip-
Only problem with that "central" error message, is it wont be central for everyone. It could look quite bad.
Geforce Fan #22
Posted 20 October 2013 - 11:37 AM
You mean people with smaller GUIs?
I'm pretty sure(don't quote me) that the majority of people play on the Large GUI
Besides, you're probably not going to see the error message often.
theoriginalbit #23
Posted 20 October 2013 - 11:46 AM
I'm pretty sure(don't quote me) that the majority of people play on the Large GUI
I have mine on small or normal, unless I'm doing Thaumcraft 4 then I need large to read his GUIs.
Geforce Fan #24
Posted 20 October 2013 - 11:59 AM
Well, I could put something in options where you would specify how large your GUIs are and it would adjust the position and size
Issue is is that I don't know how OpenPeripheral does to the scaling— like, I don't know how to make a 10x10 box be able to scale up so that it would look the same in large and normal.
And do you have to constantly resize your GUI to see the computercraft monitors? They're so tiny on small or normal!
Edit: I've found the scale, you multiply everything size and position by 1.5 and set text scale to 1.5 for normal.
Incorporating this awesome stuff into Glass.
Wow, adjusting this is a hard process. I keep having to switch gui sizes, and at normal I keep clicking save and quit instead of options.
UGH:
oden the fish #25
Posted 30 June 2014 - 10:25 AM
it wont work (im sure its something imdoing or not doing ) its all installed im using a basic computer and it wont show anything to do with the glass program can you tell me what im doing wrong?
theoriginalbit #26
Posted 30 June 2014 - 10:30 AM
Issue is is that I don't know how OpenPeripheral does to the scaling
it does scaling based on how Minecraft does the scaling. in any case you shouldn't have to compensate for it at all. if you create a box that is 10x15@0,0 [WxH at X,Y] and wanted to place a box beside it with the dimensions 100x15 then you would render it at 10,0 [X,Y] (10 being the width of the first box). if it requires you to use different numbers at other scales, then it isn't being scaled.
Edited on 30 June 2014 - 08:31 AM
Geforce Fan #27
Posted 30 June 2014 - 10:24 PM
try not to re-resurect old topics, otherwise known as GraveDigging
Glass is old and badly coded; you might want to look at alternatives such as Plastic. I could fix it up recode if you want me to.
Edited on 30 June 2014 - 08:25 PM
oden the fish #28
Posted 01 July 2014 - 01:54 AM
try not to re-resurect old topics, otherwise known as GraveDigging
Glass is old and badly coded; you might want to look at alternatives such as Plastic. I could fix it up recode if you want me to.
i looked at plastic and it didnt work :(/> i came here to see if this worked better
it seems that all termenal glasses programs are outdated they look really cool and also i have a pair of glasses and a bridge that i dont know what to do with lol
Win7yes #29
Posted 01 July 2014 - 02:20 AM
It crashes on startup: says Launch:35: attemp to call nil
Geforce Fan #30
Posted 01 July 2014 - 04:45 AM
Well, I don't know what to tell you. Like I've said; this is very old.
edit:
You don't have a terminal glasses bridge or you set it up wrong. Wipe the computer and try again. This is your fault; not mine.

try not to re-resurect old topics, otherwise known as GraveDigging
Glass is old and badly coded; you might want to look at alternatives such as Plastic. I could fix it up recode if you want me to.
i looked at plastic and it didnt work :(/> i came here to see if this worked better
it seems that all termenal glasses programs are outdated they look really cool and also i have a pair of glasses and a bridge that i dont know what to do with lol
I don't know why but terminal glasses are dead. The thing is is that we have pocket computers now–they sorta replace terminal glasses.
The issue with terminal glasses is that you can't bind keys–if you could they'd be amazing.

one thing I might do with them is use them to render html – they have boxes and such and I'm psure it'd be easier to port html to them and browse the web. the issue is that idea means you'll only be able to do it on terminal glasses. I might get to doing some cool stuff with 'em. we'll see.
Edited on 01 July 2014 - 02:53 AM