Hi all I am trying to write a program to control sgcraft gates and
am having some trouble with the server side of things heres what I have
so far:
##########################################################################
local c = require("component")
local e = require("event")
local m = c.modem
local s = c.stargate
local computer = require("computer")
()
m.open(20)
m.broadcast(20, "Online.")
local _, _, f1, port, _, message1 = e.pull("modem_message")
if message1 == "s.dial('s.localAddress()')" then
m.send(f1, 20, io.stderr:write("Cannot connect to self."))
else if message1 == "s.dial('???-??????')" and s.energyAvailable() < s.energyToDial('????-??????') then
m.send(f1, 10, io.stderr:write("Not enough energy to dial that gate."))
else if message1 == "s.dial('????-??????')" and s.stargateState() == "Idle" then
m.send(f1, 20, "Dialing.")
else if message1 == "s.closeIris()" and s.irisState() ~= "offline" then
m.send(f1, 20, "Closing Iris.")
else if message1 == "s.openIris()" and s.irisState() ~= "offline" then
m.send(f1, 20, "Opening Iris.")
else if message1 == "s.disconnect()" and s.stargateState() ~= "Idle" then
m.send(f1, 20, "Disconnecting.")
---- else if message1 ==
else
m.send(f1, 20, io.stderr:write("Command Not Recognized. PLease wait 30 SECONDS for shutdown"))
end
end
end
end
end
end
-----print("Hello")
(message1) ----This is where I am having trouble
computer.shutdown()
#########################################################################
Right now the computer is hooked up to a stargate with an Iris and I cam call the methods
directly from the computer but I want to run them from a tablet so I can
bury the computer and leave it with no screen and a wake message.
what I want it to do is if I send s.closeIris() the Iris will close but I am just getting a
/home/dial:37: syntax error near 'computer'
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi all I am trying to write a program to control sgcraft gates and
am having some trouble with the server side of things heres what I have
so far:
##########################################################################
local c = require("component")
local e = require("event")
local m = c.modem
local s = c.stargate
local computer = require("computer")
()
m.open(20)
m.broadcast(20, "Online.")
local _, _, f1, port, _, message1 = e.pull("modem_message")
if message1 == "s.dial('s.localAddress()')" then
m.send(f1, 20, io.stderr:write("Cannot connect to self."))
else if message1 == "s.dial('???-??????')" and s.energyAvailable() < s.energyToDial('????-??????') then
m.send(f1, 10, io.stderr:write("Not enough energy to dial that gate."))
else if message1 == "s.dial('????-??????')" and s.stargateState() == "Idle" then
m.send(f1, 20, "Dialing.")
else if message1 == "s.closeIris()" and s.irisState() ~= "offline" then
m.send(f1, 20, "Closing Iris.")
else if message1 == "s.openIris()" and s.irisState() ~= "offline" then
m.send(f1, 20, "Opening Iris.")
else if message1 == "s.disconnect()" and s.stargateState() ~= "Idle" then
m.send(f1, 20, "Disconnecting.")
---- else if message1 ==
else
m.send(f1, 20, io.stderr:write("Command Not Recognized. PLease wait 30 SECONDS for shutdown"))
end
end
end
end
end
end
-----print("Hello")
(message1) ----This is where I am having trouble
computer.shutdown()
#########################################################################
Right now the computer is hooked up to a stargate with an Iris and I cam call the methods
directly from the computer but I want to run them from a tablet so I can
bury the computer and leave it with no screen and a wake message.
what I want it to do is if I send s.closeIris() the Iris will close but I am just getting a
/home/dial:37: syntax error near 'computer'
Can anyone help me?
Thank you in advance.
Edited by squall2044Added more info
Link to post
Share on other sites