Code:
##################################################################
#################### Made by Hidden Evil #########################
##################################################################
@name Gate-Controller
@inputs SG_Active SG_Chevron
@outputs SG_Dial_Address:normal SG_Dial_Mode SG_Close:normal SG_Disable_Autoclose SG_Iris Address:string C1 C2 C3 C4 C5 C6 C7 C_fail
@trigger all
@persist Dial:normal Temp:array
#####Edit your commands here######################################################
A= "addr" # Saves address to memory => "addr waters"
D= "dial" # Dials saved address or dials address direcly => "dial" or "dial waters"
R= "reset" #Resets the saved address
S= "shutdown" # Deactivates the Stargate
I0= "iris 0" # Closes the iris/shield
I1= "iris 1" # Opens the iris/shield
M0= "mode 0" # Disables quickly dialling (only SG1-Gate)
M1= "mode 1" # Enables quickly dialling (only SG1-Gate)
DAC0= "dac 0" # Disables automaticly Stargate-closing
DAC1= "dac 1" # Enables automaticly Stargate-closing
##################################################################################
runOnChat(1)
SG_Close=0
if(chatClk(owner())){
Temp=lastSaid():explode(" ")
if (lastSaid()==M0) {hideChat(1),SG_Dial_Mode=0, hint("Slow Dial-Mode",3)}
if (lastSaid()==M1) {hideChat(1),SG_Dial_Mode=1, hint("Fast Dial-Mode",3)}
if (lastSaid()==DAC0) {hideChat(1),SG_Disable_Autoclose=0, hint("Autoclose enabled",3)}
if (lastSaid()==DAC1) {hideChat(1),SG_Disable_Autoclose=1, hint("Autoclose disabled",3)}
if (lastSaid()==I0) {hideChat(1),SG_Iris=0, hint("SG_Iris opened",3)}
if (lastSaid()==I1) {hideChat(1),SG_Iris=1, hint("SG_Iris closed",3)}
if (lastSaid()==R) {hideChat(1),Address="", hint("Address deleted",3)}
if ((Temp[1,string]==A | Temp[1,string]==D))
{ hideChat(1),
Adr=Temp[2,string]
if (Adr:length()==6)
{
if (Temp[1,string]==A)
{Address=Adr, hint(Address+" saved",3)}
else
{Address=Adr,hint("Dialling...",3),Dial=1}
}
else {hint("Incorrect address!",3)}
}
if (lastSaid()==D & Address!="") {hideChat(1),hint("Dialling...",3),Dial=1}
if (lastSaid()==S) {hideChat(1),SG_Close=1, hint("Stargate disabled",3)}
}
runOnTick(1)
if (SG_Active==1 | Address==""){SG_Dial_Address=0}
if (Dial==1)
{
timer("C1",15)
timer("C2",30)
timer("C3",45)
timer("C4",60)
timer("C5",75)
timer("C6",90)
timer("C7",105)
if (clk("C1")){SG_Dial_Address=toByte(Address,1)}
if (clk("C2")){SG_Dial_Address=toByte(Address,2)}
if (clk("C3")){SG_Dial_Address=toByte(Address,3)}
if (clk("C4")){SG_Dial_Address=toByte(Address,4)}
if (clk("C5")){SG_Dial_Address=toByte(Address,5)}
if (clk("C6")){SG_Dial_Address=toByte(Address,6)}
if (clk("C7")){SG_Dial_Address=13,Dial=0}
if (SG_Dial_Address<0) {SG_Dial_Address=0}
}else {SG_Dial_Address=0}
if (SG_Chevron==1){C1=1}else {C1=0}
if (SG_Chevron==2){C2=1}else {C2=0}
if (SG_Chevron==3){C3=1}else {C3=0}
if (SG_Chevron==4){C4=1}else {C4=0}
if (SG_Chevron==5){C5=1}else {C5=0}
if (SG_Chevron==6){C6=1}else {C6=0}
if (SG_Chevron==7){C7=1}else {C7=0}
if (SG_Chevron==-7){C_fail=1}else {C_fail=0}