Team Spartan Cookies & Milk Forums
[Resolved] 7 and 8 Chevron Locks - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html)
+--- Thread: [Resolved] 7 and 8 Chevron Locks (/thread-1544.html)



[Resolved] 7 and 8 Chevron Locks - Eli Wallace[FR] - 21-01-2016

So i was editing a CAP E2 (Stargate Chevron sound) and adding a AI named Riley. The AI tell each chevron is lock like this: "Chevron X is locked. Chevron X² is encoded.".
It's was easy for the 6 first chevron and the 9th chevron, but I'm having trouble dealing with the 7th and 8th chevron: I can't find a way to distinguish a Origin point lock (ending the dialling) or a normal lock. I try to mimic the orginal E2 code;
Code:
if(Chevron==7 & !Inbound & Chevron_Locked & Ch!=Chevron) { say("Chevron seven is lock!") } elseif(Chevron==7 & !Inbound & !Chevron_Locked & Ch!=Chevron) { say(" Chevron seven lock.") say(" Chevron eight encoded") }
But it didin't work. Ether the first one worked on a 8/9 chevron dial or nothing worked or the second one worked. It's like the E2 don't know what to do!
I tryed to edit stuff but in the end it don't work.
I'm gonna post here the whole code so you can get a look and see what's wrong.
Code:
# Created by AlexALX (c) 2011-2012 # For addon Stargate Carter Addon Pack # http://sg-carterpack.com/ # Chat Notification added by ELi Walace[FR] @name Stargate chevron sounds and Chat Notification @inputs Active Chevron Chevron_Locked Open Inbound @outputs @persist Inc Fail Ch A @persist [Name]:string @trigger #------------------------------------------------------------------------------------------------------------------------------------------------- function void say ([String]:string) { owner():soundPlay(999,3,"st/shuttlecraft/computer_respond.mp3") printColor(vec(100,230,200),"[Riley] ",vec(0,180,255),Name+": ",vec(230),String) } #------------------------------------------------------------------------------------------------------------------------------------------------- if (Active & !Open) { if(Chevron==1 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c1.mp3") } if(Chevron==2 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c2.mp3") } if(Chevron==3 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c3.mp3") } if(Chevron==4 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c4.mp3") } if(Chevron==5 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c5.mp3") } if(Chevron==6 & !Inbound & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c6.mp3") } if(Chevron==7 & !Inbound & Chevron_Locked & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c7_locked.mp3") say("Chevron seven is lock!") } elseif(Chevron==7 & !Inbound & !Chevron_Locked & Ch!=Chevron) { #soundPlay(0,2000,"stargate/walter/c7_short.mp3") soundPlay(0,2000,"alexalx/stargate/riley/c7_encoded.mp3") say(" Chevron seven lock.") say(" Chevron eight encoded") } if(Chevron==8 & !Inbound & Chevron_Locked & Ch!=Chevron) { soundPlay(0,2000,"stargate/walter/c8_locked.mp3") say("Chevron eight is lock!") } elseif(Chevron==8 & !Inbound & !Chevron_Locked & Ch!=Chevron) { #soundPlay(0,2000,"stargate/walter/c8.mp3") - not exists soundPlay(0,2000,"alexalx/stargate/riley/c8_encoded.mp3") say("Chevron eight is lock.") say("Chevron nine encoded") } if(Chevron==9 & !Inbound & Chevron_Locked) { #soundPlay(0,2000,"stargate/walter/c9_locked.mp3") - not exists soundPlay(0,2000,"alexalx/stargate/riley/bad/c9_lock.mp3") } elseif(Chevron==9 & !Inbound & !Chevron_Locked & Ch!=Chevron) { #soundPlay(0,2000,"stargate/walter/c8.mp3") - not exists soundPlay(0,2000,"alexalx/stargate/riley/c9_encoded.mp3") } if(Chevron==-7 & !Inbound & !Fail) { soundPlay(0,3000,"stargate/walter/c7_failed.mp3") Fail = 1 Ch = 6 } if(Chevron==-8 & !Inbound & !Fail) { #soundPlay(0,3000,"stargate/walter/c8_failed.mp3") - not exists soundPlay(0,3000,"alexalx/stargate/riley/bad/c8_failed.mp3") Fail = 1 Ch = 7 } if(Chevron==-9 & !Inbound & !Fail) { #soundPlay(0,3000,"stargate/walter/c9_failed.mp3") - not exists soundPlay(0,3000,"alexalx/stargate/riley/c9_failed.mp3") Fail = 1 Ch = 8 } if (Inbound & Chevron>0 & !Inc) { soundPlay(0,3000,"stargate/walter/unscheduled_offworld_activation.mp3") Inc = 1 } elseif (!Inbound & Chevron==0 & Inc) { Inc = 0 } if (Fail & !Chevron_Locked & Chevron>=0) { Fail = 0 } # Fix for DHD remove chev if (Chevron>0 & Chevron<=9 & !Chevron_Locked) { Ch = Chevron-1 } } else { Inc = 0 Fail = 0 } #------------------------------------------------------------------DEBUG STUFF----------------------------------------------------------------- if (Inbound==1) { A==1 } elseif (Inbound==0) { A==0 } #--------------------------------------------------------------CHAT-PRINT------------------------------------------------------------------------ if (Inbound==1 & Chevron==0 & Active==1 & Open==0 ) { say("Incomming wormhole!") } if (Active==1 & Inbound==0 ) { if (Chevron==0 & !Chevron_Locked & !Inbound & Ch!=Chevron) { say("Chevron one encoded") } if (Chevron==1) { say("Chevron one locked.") say("Chevron two encoded.") } if (Chevron==2) { say("Chevron two locked.") say("Chevron three encoded.") } if (Chevron==3) { say("Chevron three locked.") say("Chevron four encoded.") } if (Chevron==4) { say("Chevron four locked.") say("Chevron five encoded.") } if (Chevron==5) { say("Chevron five locked.") say("Chevron six encoded.") } if (Chevron==6) { say("Chevron six locked.") say("Chevron seven encoded.") } if (Chevron==-7) { say("Chevron seven will not lock!") } if (Chevron==-8) { say("Chevron eight will not lock!") } if (Chevron==9 & !Chevron_Locked & Ch!=Chevron & Open==0 ) { say("Chevron nine...") say("Chevron nine...") say("Chevron nine is lock!") } if (Chevron==-9 & Open==0 ) { say("Chevron nine...") say("Chevron nine...") say("Chevron nine will not lock!") } } if (Open==1 & Inbound==0 & Chevron>=7) { say("Wormhole stable") } if (Open==0 & Inbound==0 & Chevron<=-7) { say("Unable to open a stable wormhole!") }
Thanks for helping me!


RE: [Help] 7 and 8 Chevron Locks - Kosmos - 27-01-2016

You could examine the "Chevrons" output of the stargate, if one of the digits changes you can handle that being locked/encoded.


RE: [Help] 7 and 8 Chevron Locks - Eli Wallace[FR] - 30-01-2016

Thanks for the help but I managed to make it work after rewriting the whole E2 and playing with timers.