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

[SGCraft] SG-Control System (v1.4) *Update*

Started by SeaLife, 01 February 2014 - 05:30 PM
SeaLife #1
Posted 01 February 2014 - 06:30 PM
Hey Community

Today i'll show you my Stargate Control System



BTW: Its not finished yet

Screens:
Spoiler









startup
Spoiler

shell.run("bios.lua")
shell.run("sg.lua", "YouSGAddress")

Required Files:
* sg.lua
* sg_screens.lua
* sg_hooks.lua
* sg_mod.lua
* bios.lua

Mirror:
* Github: Github (Master)

Additional SG-Mods:
* /mods/sg_monitor.lua

Required Mods:
* Minecraft
* OpenPeripheral's Snapshot 42 (44 and 45 DOESNT WORK!)
* ComputerCraft 1.57 / 1.58
* SGCraft 0.7.3 (should work with LanteaCraft, but not tested!)

(You can use my own Build which including all snapshot-45 fixes and SGCraft fixes)
* OpenPeripheral's Snapshot 1-BySeaLife Build [1]

(Not uploaded to Pastebin until its completly finished)

Changelog:
Spoiler

Version 1.4:
Added Screen: Home (SG-Overview)
Rewritten: sg_mod.lua (Now can add external mods for "Multimods")
Update: Documentation of Modding
Added Mod: Monitor-Dialer Mod

Version 1.3:
Added sg_hooks.lua
Added Screen: List (SG-Dialer)
Added Screen: Config (SG-Configuration)

Version 1.2:
Added sg_mod.lua

Version 1.1:
Added sg_screens.lua

Version 1.0:
Initial Release

Custom Installer:
Spoiler

local url = "http://sealife.top-web.info/cc/sg/"

local f = {}
f[1] = http.get( url .. "sg.lua")
f[2] = http.get( url .. "sg_hooks.lua")
f[3] = http.get( url .. "sg_screens.lua")
f[4] = http.get( url .. "sg_mod.lua")
f[5] = http.get( url .. "bios.lua")

local c = {}
c[1] = f[1].readAll()
c[2] = f[2].readAll()
c[3] = f[3].readAll()
c[4] = f[4].readAll()
c[5] = f[5].readAll()

f[1].close()
f[2].close()
f[3].close()
f[4].close()
f[5].close()

local s = {}
s[1] = fs.open("sg.lua", "w")
s[2] = fs.open("sg_hooks.lua", "w")
s[3] = fs.open("sg_screens.lua", "w")
s[4] = fs.open("sg_mod.lua", "w")
s[5] = fs.open("bios.lua", "w")

s[1].write(c[1])
s[2].write(c[2])
s[3].write(c[3])
s[4].write(c[4])
s[5].write(c[5])

s[1].close()
s[2].close()
s[3].close()
s[4].close()
s[5].close()

-- Startup File
local f = fs.open("startup", "w")
f.writeLine('shell.run("bios.lua")')
f.writeLine('shell.run("sg.lua")')
f.close()
os.reboot()


You can Modificate the System completly with sg_mod.lua.
in sg_mod.lua you'll find instructions to do edits

Have Fun


Documentation of Modding:
Spoiler

--[[

Add a Menu Point:
-- SGControl.Menu[ @Arg1 ] = { name=@Arg2, funct=@Arg3 }
--@Arg1: Index (Number)
--@Arg2: MenuName (String)
--@Arg3: Menu Function (Function)

Add a Config:
-- SGConfig[ @Arg1 ] = { Name=@Arg2, State=@Arg3}
--@Arg1: Index (Number)
--@Arg2: ConfigName (String)
--@Arg3: ConfigState (Boolean)

Add a Screen Type:
-- StargateScreen.Modes[ @Arg1 ] = @Arg2
--@Arg1: ScreenMode (String)
--@Arg2: Screen Function / Content (Function)

Add a System-Hook:
-- SGControl.Hooks[ @Arg1 ] = @Arg2
--@Arg1: Index (Number)
--@Arg2: Hook-Function (Function)

You can edit all Menu-Names:
-- SGControl.Menu[ @Arg1 ].name = @Arg2
--@Arg1: MenuItem [1-4 for Default Items] (Number)
--@Arg2: Menu Name (String)

You can add new Stargates on Startup
-- SGControl.addStargate( @Arg1, @Arg2 )
--@Arg1: Stargate Address (String)
--@Arg2: Stargate Displayname (String)

You can remove Stargates on Startup
-- SGControl.removeSG( @Arg1 )
--@Arg1: Stargate Address (String)

You can add your own LOG Entry
-- SGControl.addLog( @Arg1, @Arg2 )
--@Arg1: Log-File (String)
--@Arg2: Log-Entrie (String)

You can add an External Mod with:
-- SGControl.addExternalMod( @Arg1 )
--@Arg1: File Path (String)

]]--



You've panic with using a file like "bios.lua"?
Here are some ideas, how to rename the file, so that you dont need to have panic anymore…

mv bios.lua sg_api.lua
mv bios.lua shell32.lua
mv bios.lua hello.lua
mv bios.lua nope.lua
mv bios.lua trololololololol.lua
So, it doesnt matter, which filename you'r using for the "bios.lua", just execute the file, before executing sg.lua

Thank you …
Edited on 02 February 2014 - 11:36 AM
awsmazinggenius #2
Posted 01 February 2014 - 06:55 PM
I personally wouldn't use something like this if it modifies bios.lua, as you have to edit the BIOS of every computer.
SeaLife #3
Posted 01 February 2014 - 07:07 PM
You dont have to edit it.
I just named it Bios.lua because it workes like a System Api…
This Program is a bit large and unfinished ^^
awsmazinggenius #4
Posted 01 February 2014 - 07:09 PM
I'm not sure whether that will work due to the way bios.lua is included in ComputerCraft.zip - could you please consider renaming it?
SeaLife #5
Posted 01 February 2014 - 07:10 PM
O.o it doesnt replace anything because the main CC Bios is in the ROM folder and ReadOnly…
awsmazinggenius #6
Posted 01 February 2014 - 07:15 PM
I think it's kept just outside the rom folder, but's it's hidden. Though, I guess in CC, you'd just name the file "bios" (CC files are extension-less) and it would be good.
SeaLife #7
Posted 01 February 2014 - 07:17 PM
It doesnt matter if the file ie named
.exe
.lua
.asdf
.jar

Or whatever… Everything outside of ROM doesnt affect the ROM…
Only if someone replaces some functions…
awsmazinggenius #8
Posted 01 February 2014 - 07:51 PM
Are you saying I can name the file bios (no extension), or that you can create a file called bios.lua in the root directory and have it not affect anything?
SeaLife #9
Posted 02 February 2014 - 03:27 AM
Are you saying I can name the file bios (no extension), or that you can create a file called bios.lua in the root directory and have it not affect anything?

The bios.lua file doesnt affect by it self or replaces some os.* function
function… You can call the bios.lua whatever you want, you only have to execute before sg.lua


Yes, sure… You can name it "bios", "bios.lua", "bios.exe", …. ( What ever the fu** you want ;D )
Edited on 02 February 2014 - 03:10 AM