Code:
##################################################################
#################### Made by Hidden Evil #########################
##################################################################
@name Gate-Controller
@inputs SG_Active SG_Open SG_Inbound SG_Chevron
@outputs SG_Dial_Address:normal SG_Dial_Mode SG_Close:normal SG_Disable_Autoclose SG_Iris C1 C2 C3 C4 C5 C6 C7 C_fail
@trigger all
@persist Dial:normal Command:array Address:string Addresses:array Kill Close Sp
#####Edit your commands here######################################################
A= "addr"
# Saves address to memory => "addr 8 waters" (max. 8 places!)
L= "list"
# Lists all saved addresses
D= "dial"
# Dials direcly or a saved address => "dial waters" or "dial 8"
RD= "redial"
# Redials the last dialled address
R= "reset"
# Resets a saved address or all together => "reset" 8 or "reset all"
S= "close"
# Closes the Stargate
Spam= "spam"
# Dials a Stargate again and again, without closing :D
# Dialling cannot (!) be stopped, unless of typing "spam stop"
I1= "iris 1"
# Opens the iris/shield
I0= "iris 0"
# Closes the iris/shield
M1= "mode 1"
# Enables quickly dialling (only SG1-Stargate)
M0= "mode 0"
# Disables quickly dialling (only SG1-Stargate)
DAC1= "dac 1"
# Disables automaticly Stargate-closing
DAC0= "dac 0"
# Enables automaticly Stargate-closing
K1= "kill 1"
# Makes dialling impossible and inbound wormholes closes automaticly
K0= "kill 0"
# Reactivates the Stargate
##################################################################################
runOnChat(1)
runOnTick(1)
Close=0
if(chatClk(owner())){
Command=lastSaid():explode(" ")
if (lastSaid()==S) {hideChat(1),Close=1, hint("Stargate disabled",3)}
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()==K0) {hideChat(1),Kill=0, hint("Stargate enabled",3)}
if (lastSaid()==K1) {hideChat(1),Kill=1, hint("Stargate killed",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()==RD)
{ hideChat(1),
if (Address=="")
{
hint("No address in memory",4)
}
else
{
hint("Redialling "+Address,3),Dial=1
}
}
if (lastSaid()==L)
{ hideChat(1),Counter=1,
while (Counter<=8)
{
if (Addresses[Counter,string]!="")
{hint("Address "+Counter+" => "+Addresses[Counter,string],7),Counter++}
else {Counter++}
}
}
if (Command[1,string]==A)
{ hideChat(1),
if (Command[3,string]:length()==6 & Command[2,normal]>=1 & Command[2,normal]<=8)
{
Addresses[Command[2,normal],string]=Command[3,string]
hint(Command[3,string]+" saved to slot "+Command[2,normal],4)
}
else {hint("Incorrect order!",3)}
}
if (Command[1,string]==D)
{ hideChat(1),
if (Command[2,normal]>=1 & Command[2,normal]<=8)
{
Address=Addresses[Command[2,normal],string],hint("Dialling "+Address,3),Dial=1
}
elseif (Command[2,string]:length()==6)
{
Address=Command[2,string],hint("Dialling "+Address,3),Dial=1
}
else {hint("Incorrect order!",3)}
}
if (Command[1,string]==R)
{ hideChat(1),
if (Command[2,normal]>=1 & Command[2,normal]<=8)
{
Addresses[Command[2,normal],string]="", hint("Address "+Command[2,normal]+" deleted",3)
}
elseif (Command[2,string]=="all")
{ Counter=1
while (Counter<=8)
{
Addresses[Counter,string]="",Counter++
}
hint("All address deleted!",3)
}
else {hint("Incorrect order!",3)}
}
if (Command[1,string]==Spam)
{ hideChat(1),
if (Command[2,string]:length()==6)
{
Address=Command[2,string]
Sp=1,Dial=1
}
elseif (Command[2,string]=="stop")
{
Sp=0,Close=1
}
else {hint("Incorrect order!",3)}
}
} # end of if(chatClk(owner())){
if (SG_Active==1 | Address==""){SG_Dial_Address=0}
if (Dial==1)
{
timer("C1",20)
timer("C2",40)
timer("C3",60)
timer("C4",80)
timer("C5",100)
timer("C6",120)
timer("C7",140)
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,if(!Sp){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}
if (Kill==1){SG_Close=(SG_Active & randint(0,1))}else{SG_Close=Close}