Skip to content

Instantly share code, notes, and snippets.

@chewtoys
Last active November 11, 2021 23:33
Show Gist options
  • Save chewtoys/f54c2d3eb35d0d2b5f2fe30de715f149 to your computer and use it in GitHub Desktop.
Save chewtoys/f54c2d3eb35d0d2b5f2fe30de715f149 to your computer and use it in GitHub Desktop.
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
if:Eco*(:FCUForward>60)then:FCUForward=60end
if(:BatteryLevel<1500)then:FCUForward=0end goto1
-------------------------------------------------------------------------
b=:BatteryLevel>=9995 G=:Generator gr=:GenRate m=51*(1-:ECO)+101*:CBOS
m+=33*(:FCUForward>0)*(m==0) ifG<m+b*(m==0+G>m)thenG=m end
G+=1*(b!=1)*(G<=gr)*(gr<100) G-=1*b*(G>=gr)*(gr>0) G*=:Shutdown
:Generator=G :GenRate=:GeneratorUnitRate m=0 goto1
// b = current battery level
// G = current generator setting
// gr = current generator rate (how close to setting)
// m = minimum battery level, 0 base, 33 if forward engines on,
// 51 if Eco button off, 101 if Cargo Beams are on
// G is raised by 1 or lowered by 1 to keep battery charged so long
// as G is at least minimum.
-------------------------------------------------------------------------
a="\n" b="Prop: " c="Fuel: " d=1000 e=60 f=3600 g=":" z="Infinite"
h=z i5=i4 i4=i3 i3=i2 i2=i1 i=:GasNetworkStoredResource i=i1+i2+i3+i4
i+=i5 i/=5 h=(j-i)/((j-i)>0) j=i k=h/f/d*d l=(h-k*f)/e/d*d
m=(h-k*f-l*e)/d*d h=k+g+l+g+m n=z o=:FuelChamberFuel n=o/(p-o) p=o
k=n/f/d*d l=(n-k*f)/e/d*d m=(n-k*f-l*e)/d*d n=k+g+l+g+m
:TimeLeft=a+a+b+h+a+a+c+n goto2
-------------------------------------------------------------------------
o=" Ore" c=" Crystal" e="\n\n - Error -" s="\n\nScanning." nx="\n x "
:Scanner="\n\n Offline" :Reset=1 goto 2+:ScanOre
:Scanner=s s=s-"..."+"." :Scan=1 if not:Res then goto 2+:ScanOre end
:Scanner="\n\n Results\n Pending" t="\n" m=""
t+="\n "+:Mat-o-c+nx+(:Vol/1728) m+=:Mat goto 5+:Idx++==:Res
if m!="" then :Scanner=t else :Scanner=e end :ScanOre=0 :Reset=1
goto 7-(4*:ScanOre)
// Rename the panelVariable field to Scanner on the text screen where
// you wish the material points scanner results to be displayed
// Rename the Material Points Scanners fields for Active, ScanResults,
// Material, Volume, and Index to ScanOre, Res, Mat, Vol and Idx.
// Rename a buttons ButtonState field to ScanOre and set its
// ButtonStyle value to 1 to make it a toggle.
-------------------------------------------------------------------------
d=15 a=15 r=:ApproachDist r*=r<:ApproachLength goto1/(1-r*:Approach>0)
:FcuForward=(r>d)*(r-d)/a :FcuBackward=(r<d)*(-100*r/d+100) goto1
// Basic linear approach sets FCU inputs as a factor of how far we are
// from the chosen distance (d).
// The forward input is modified by the approach factor (a), where
// a higher value means a slower approach suitable for heavy ships.
// Script automatically rejects non-hits (RF=max length, or 0).
//
// Inputs: ApproachDist RangeFinderDistance of approach RF
// ApproachLength RangeFinderSearchLengh of approach RF
// Approach ButtonOnState of some button to toggle
//
// Outputs: FcuForward, FcuBackward
-------------------------------------------------------------------------
s=10 Kp=0.3 Ki=0.01 Kd=4 t=3 m=1000 g=1/m p=0 goto1+:Approach>0
r=:RFD e=r-s d=e-p i+=e/(d-g) i/=2 o=Kp*e+Ki*i+Kd*d p=e r*=r<m
z/=:Approach*r*(d*d>g+e*e>1) :FcuForward=o/t :FcuBackward=-o*t goto2
:Approach=0 :FcuForward=0 :FcuBackward=0 goto1
// PID approach uses a proportional-integal-derivative controller to
// output FCU values appropriate to the distance and current speed.
// It has several tunables:
// s (setpoint) the distance we want to get to
// Kp (proportional) how much we factor in our current distance
// Ki (integral) factor of how long we've been at our distance
// Kd (derivative) factor of prediction of where we'll be in future
// t (thrust diff) account for disparity in forward/rev thrust power
-------------------------------------------------------------------------
:TurretRotation=(20-40*(++i>5))*(:Sweep>0) i*=i<10 goto1
-------------------------------------------------------------------------
if :Wipe then :Static=0 :Saw=0 :LP=-12 :LY=0 Y=0 goto2 end goto1
Y++ if y>5 then goto3 end :LY=Y :LP++ if :Wipe==0 then goto4 end goto2
Y-- if y<-5 then goto2 end :LY=Y :LP-- goto3
:LP=0 :LY=0 goto1
-------------------------------------------------------------------------
RA=100 if:Approach then:RFT=1 :RFB=1 :RFR=1 :RFL=1elsegoto1end
A=:Distance F=:TD-A G=:BD-A J=:RD-A K=:LD-A if1-:Approach thengoto9end
ifF>RA thengoto5end ifG>RA thengoto6end
ifJ>RA thengoto7end ifK>RA thengoto8end goto2
:FcuUpDown=-2 F=0 goto2 // -2 and 2 depends on your ships //down
:FcuUpDown=2 G=0 goto2 // ability to strafe up and down // up
:FcuRightLeft=-20 J=0 goto2 //-20 and 9 is // Left
:FcuRightLeft=9 K=0 goto2 // Right
:RFT=0 :RFB=0 :RFR=0 :RFL=0 goto1
// around your Rangefinder that is used for Approach 4 more are needed
//Main Rangefinder Distance is :Dist (my PID one uses that)
//Rangefinders are named as follows Top = RFT as name TD as distance
//Bottom = RFB Distance = BD RFR right RFL Left with RD and LD
//A button labeled as Approach which is used by the Approach script
-------------------------------------------------------------------------
might actually be handy for someone. if anyone is using a switch (-1, 0, 1) to go between 3 modes on your autogen setup this can keep each mode a single line + update a progressbar for battery amount on that line
t=10000 b=14 e=80 c=100 goto:MMDs+3
:Batteries=:B1*b :Gen=50+(t-:B1)/80 goto:MMDs+3
:Batteries=:B1*b :Gen=(:AutoGen)*(t-:B1)/e+(1-:AutoGen)*c goto:MMDs+3
:Batteries=:B1*b :Gen=80+(t-:B1/80) goto:MMDs+3
actual settings for your autogen is up to you but thats a pretty basic setup.
:batteries is a progress bar displaying battery amount.
:b1 is the name of a battery, we multiply it by b which is the amount of batteries we have. e and c is just to save character space on line 3.
:MMDs is the name of our switch.
Line 2 is -1 state on switch, line 3 is 0 state, line 4 is +1 state.
in the above snipped -1 state = auto gen that has a minimum of 50 generator rate, 0 state is a normal autogen (minimum of 0) and +1 is minimum of 80.
will also need a button called :AutoGen (or tweak the code ofc) since if :AutoGen button is off and state is 0 then there is no limit and generator goes to 100
-------------------------------------------------------------------------
a=1000 b=60 c=3600
RT="inf" RT=:Rod/(R-:Rod) R=:Rod
h=RT/c/a*a m=(RT-h*c)/b/a*a s=(RT-h*c-m*b)/a*a RT=h+":"+m+":"+s
PT="inf" PT=:Prop/(P-:Prop) P=:Prop
h=PT/c/a*a m=(PT-h*c)/b/a*a s=(PT-h*c-m*b)/a*a PT=h+":"+m+":"+s
:RodTime="\n\n "+RT+"\nPropTime:\n "+PT goto 2
// Change FuelChamberFuel to Rod, GasNetworkStoredResource to Prop
// Text panel, RodTime
// Required> Basic
-------------------------------------------------------------------------
i=:insideSafeZone x=25 :BeaconWarn=:Beacon*(not i) :TBC=2*i a=1-i
if(not b)*a then:Beacon=0 b=1end goto:Beacon*a*b*3
x-- if x>0 then goto3 end b=0 goto1
// BeaconWarn, warning button button enable blink field name
// TBC: warning button Button Color field name
// Beacon: warning button and transponder first field names
// x: time transponder stays on in unsafe
// This code turns off transponder if you cross into unsafe.
// If you turn it back on, it stays on for x/5 seconds then turns off.
// It also changes the color of the warning button to red if unsafe.
// and makes it blink if unsafe and on.
-------------------------------------------------------------------------
IF :Nav_Lights ==1 then goto2 else goto1 end
:NavRed =1 :NavGreen =1
12 :NavRed =0 :NavGreen =0
-------------------------------------------------------------------------
d=2.16 o=-1.6 p=3.141 x=360/(2*p)
l=:d+o c=d/l :MinerPitch=((p/2)-(c+(c^3)/6+(c^5)/40))*x goto1
// Laser divergence
// d=distance laser off axis
// o=forward offset of rangefinder
//lasers resting point at 0deg face each other directly
//and pointing straight forward is 90 deg
-------------------------------------------------------------------------
a=1 b=2 :MiningLaserOn=:Fire*(t<a) p=a+b-1 t+=t<p-t*(t>=p) goto1
a=on time in ticks
b=off time in ticks
-------------------------------------------------------------------------
// Variables for Tweaking
a = 9500 // If Battery Amount is lower than this, Gen is 100%
// Static variables and precalculation
c = 10000 // Max Stored Battery Power
d = 100 // 100%
e = (c-a)/d
Gen = :chamber // Chamber Unit Rate Limit
Bat = :battery // Stored Battery
// Final Generator Scriptline
Gen=((Bat<a)*d)+((Bat>a)*((Bat-c)*-1)/e) goto 10
-------------------------------------------------------------------------
s=10 Kp=1.5 Ki=0.01 Kd=18 t=4.5 m=1000 g=1/m p=0 goto1+:Approach>0
r=:RFD e=r-s d=e-p i+=e/(d-g) i/=2 o=Kp*e+Ki*i+Kd*d p=e r*=r<m
z/=:Approach*r*(d*d>g+e*e>1) :FcuForward=o/t :FcuBackward=-o*t goto2
:Approach=0 :FcuForward=0 :FcuBackward=0 goto1
-------------------------------------------------------------------------
dur=:TotalValue/:ValuePerSecond
S=dur/60*100 dur-=S dur/=60 IF S<10 THEN S="0"+S END
M=dur/60*100 dur-=M dur/=60 IF M<10 THEN M="0"+M END
H=dur dur-=H IF H<10 THEN H="0"+H END IF H>99 THEN H="99" END
:Output="\nHH:MM:SS\n"+H+":"+M+":"+S GOTO1
// :TotalValue is the total value that it could be
// :ValuePerSecond is using the VPS script to calculate the delta per second
// :Output is where the content goes. Can be customized to only output the time
// This requires a BASIC chip
-------------------------------------------------------------------------
// Single Mining Turntable Turret - ChrisH619 (Chrisanthynol)
perstep=2 min=-8 max=8
:MLOn=0 ix=0 s=1 :LTR=0 IF :Laser==0 THEN goto2 END
:MLOn=0 IF :Laser==0 THEN goto2 END ix+=s next=ix*perstep
:MLOn=1 :LTR=next IF next<=min OR next>=max THEN s*=-1 END goto4
// Add a Button for `Laser`
// Uses any number of Turntables `TurretRotation` => `LTR`
// Uses any number of Mining Lasers `MiningLaserOn` => `MLOn`
// Moves the turrent from -8degrees -> 8degrees, at 2degree increments
-------------------------------------------------------------------------
lP=:Propellant lF=:Fuel i=0
if i++ < 24 then goto 2 end
p=:Propellant f=:Fuel
tc=((i*0.2)+2) dP=(lP-p)/tc dF=(lF-f)/tc
pM=(p/dP)/60 fM=(f/dF)/60
:TimeLeft="\n\nFuel Time: "+fM+"m"+"\nProp Time: "+pM+"m" goto 1
-------------------------------------------------------------------------
if :MiningMode thengoto2else :TR1=-90 :TR2=90 :TP1=90 :TP2=90 goto1end
:TR1=:TRC1-(-90*:MiningOn) :TR2=:TRC2-(90*:MiningOn) goto1
-------------------------------------------------------------------------
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stks" :reset=1
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto1
if:Scanner thenif:Scan thengoto4endelse:Scn="Offline" goto1end
:i=0 if:V==0then:Scn=b+"Scanning.." goto2end :Scn="Analyzing"
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o
:Scanner=0 goto1
-------------------------------------------------------------------------
o=" Ore" c=" Crystal" n="\n" f="" :Scan=1/(1-:Volume*:Scanner>0) goto1
f+=:Material-o-c+n+:Volume/1728+n goto3-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto1
// Rename `Active` -> `Scanner` on your Material Point Scanner, set up
// a text panel `Scanned`, an activation button `Scanner`, and a
// button `Continuous` to toggle between single and continuous scans.
-------------------------------------------------------------------------
p=-1.6 a=2.45 b=0.571 c=57.295 d=1.571
o=:RFD+p t=o/a :CA=(b*t+t*t)/(1+2*b*t+t*t)*c*d goto2
// Basic-chip arctangent calculation takes rangefinder distance :RFD
// and outputs appropriate convergence angle :CA. It has tunables -
//
// p (opposite-offset) - how far forward/back your rangefinder is
// in relation to the hinge point of the lasers.
//
// a (adjacent) - how far off to the side your lasers' hinge point
// is in relation to the rangefinder beam.
-------------------------------------------------------------------------
a=1000 b=3600 c=a*b d=":" e="\nfuel time:\n"
ft=:fuel/(:fuelrate*75/100) r=(hy-:hydrogen)/0.84 hy=:hydrogen ht=hy/r
fh=ft/c*a fm=(ft-fh*b)/60/a*a fs=(ft-fh*b-fm*60)/a*a
gh=ht/c*a gm=(ht-gh*b)/60/a*a gs=(ht-gh*b-gm*60)/a*a
:flow=e+fh+d+fm+d+fs+"\nhydro time:\n"+gh+d+gm+d+gs goto2
Fuel rod remaining = :fuel
Fuel rod flow rate = :fuelrate
Gas network stored = :hydrogen
display = :flow
single basic chip
-------------------------------------------------------------------------
r=:RFD e=r-s d=e-p i+=e/(d-g) i/=2 o=Kp*e+Ki*i+Kd*d p=e r*=r<m
z/=:Approach*r*(d*d>g+e*e>1) :FcuForward=o/t :FcuBackward=-o*t goto2
-------------------------------------------------------------------------
j="\nMat|Stacks" o=j a=" Ore" b="\n" d="♥" e="♡" h="ium" TO=20
:autoscan-=s s=e :autoscan=s+:autoscan f=1728000 :Re=1 :L=0 goto2+:AS
:autoscan-=s s=d :autoscan=s+:autoscan g="ite" i=0 :I=0 :L=1 :R=0 :S=1
tv=0 o=j c=" Crystal" i++ if i>TO then :L=0 goto9 end goto5-:S
:L=0 i/=:R :I=0 v=:V/f*1000 tv+=v o+=b+"① "+(:M-a-c-g-h)+"|"+v
i/=:R :I=1 v=:V/f*1000 tv+=v o+=b+"② "+(:M-a-c-g-h)+"|"+v
i/=:R v=tv at="\nCLass:"+(4+v>10+v>11+v>18+v>26+v>124+v>270)
i/=:R :autoscan=s+o+b+"Total Stacks:"+tv+at :S=0 :Re=1 goto2+:AS
w="\n !WARNING!" i/=:R :autoscan=s+w+"\n\n «TIMEOUT»\n"+w goto2+:AS
:autoscan=s+w+"\n\n Nothing\n Found\n"+w goto2+:AS
-------------------------------------------------------------------------
y=17280 s=":\n" f=" stacks\n" h=10 z="\n" b="" t=150 x=0
c=" Crystals" o=" Ore"
if:scanner==0 thengoto3+(++x>t)*4 end:sR=1 :sS=1 r=z q=z :LastScan=b
a=:sc>0or:ss==0 ifathenr+=:sM-c-o+s+:sV/y*h+f :i++endgoto4+(:i>=:sC)*a
if:sc==0 or:ss==1 then :sr=1 :ss=0 goto2end :LastScan=r :scanner=0
:sS=0 :sR=1 goto1
x=0 :LastScan="" goto3
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stacks" :reset=1
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto1
if:Scanner thenif:Scan thengoto3endelse:Scn="Offline" goto1end
:i=0 if:V==0then:Scn=b+"No Contact" goto2end
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o t=0
if:Scanner thenift<20thent++ goto8endelse:Scn="Offline" goto1end
// Scanner is first field name on Button and :Scanner
// Scn is first field name of Text Display
// On Scanner, rename Volume field to V, Material field to M, and
// Index field to i
-------------------------------------------------------------------------
b=" Ore" c=" Crystal" d="\n" v=1728
f="" :Scan=1/(1-:Volume*:Scanner>0) goto2
f+=:Material-b-c+d+:Volume/v+d goto4-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto2
-------------------------------------------------------------------------
So Ardyn gave me an approach script and I fitted it to the Quadugon so just wanted to share this.
I'm sure this could be condensed but it is working for me.
Notes:
d=Distance you Want Away from an Asteroid
a=Approach Speed
Button named Approach Required(You can change the name the script looks for if you want)
Recommend Binding the Button to a hotkey
Distance is the distance you will see on the foldout panel for Mining
If you aren't in mining mode Approach will be disabled, you can remove the line if you want.
Device Changes:
Change the RangeFinder above the Pilot Seat to look further than 500
Install a Chip Socket and Yolol Chip(Basic or Advanced( plus data line for it.
Replace or add a Button for Approach
Code:
r=:Distance d=15 a=15
if :MiningMode==0 then :Approach=0 goto1 end //Remove if Desired
if :Approach==0 then :FcuBackward=0 goto1 end
if (r<d) then :Approach=0 goto7 end
if 1-(1<r)*(r<500)*:Approach thengoto1end
:FcuForward=(r>d)*(r-d)/a goto1
:FcuBackward=(r<d)*(-100*r/d+100) goto1
-------------------------------------------------------------------------
b=" Ore" c=" Crystal" d="\n" v=1728
f="" :Scan=1/(1-:Volume*:Scanner>0) goto2
f+=:Material-b-c+d+:Volume/v+d goto4-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto2
Which expects an activation button in your cockpit called Scanner (to enable/disable it),
another button called Continuous (to toggle whether the beam should keep rescanning or stop/disable
itself after it's found something), and a text pannel called Scanned.
-------------------------------------------------------------------------
if Not :Laser then goto1 end
:TP= 90 if :Curr2 < 73 then goto1 end :LA = 1 :TV=0.3
:TR1 = :Curr1+180 :TR3 = :Curr3-180 if Not :Laser then goto5 end
if:TP>:Radius then :TP--else :TP=95 end :La=1 goto3
:TV=100 :TR1=0 :TR3=0 :TP=0 :LA = 0 goto1
-------------------------------------------------------------------------
m=:Mine a=:Auto :TTP=-10*m :BTP=-10*m goto2
g=(:GeneratorUnitRate>=50) :MineR=g goto (g==m)+(a*2)
m=:Mine a=:Auto :TTR-- :BTR-- :TTP++ :BTP++ goto m*a*3+i++>19
m=:Mine a=:Auto :TTR++ :BTR++ :TTP-- :BTP-- goto m*a*4+i++>39
m=:Mine a=:Auto :TTR-- :BTR-- :TTP-- :BTP-- goto m*a*5+i++>59
m=:Mine a=:Auto :TTR-- :BTR-- :TTP++ :BTP++ goto m*a*6+i++>79
i=0 :TTP=-10*m :BTP=-10*m :TTR=m :BTR=m goto1
-------------------------------------------------------------------------
a=1000 b=60 c=3600
RT="inf" RT=:Rod/(R-:Rod) R=:Rod
h=RT/c/a*a m=(RT-h*c)/b/a*a s=(RT-h*c-m*b)/a*a RT=h+":"+m+":"+s
PT="inf" PT=:Prop/(P-:Prop) P=:Prop
h=PT/c/a*a m=(PT-h*c)/b/a*a s=(PT-h*c-m*b)/a*a PT=h+":"+m+":"+s
:RodTime="\n\n "+RT+"\nPropTime:\n "+PT goto 2
// Change FuelChamberFuel to Rod, GasNetworkStoredResource to Prop
// Text panel, RodTime
// Required> Basic
-------------------------------------------------------------------------
:AutocannonChargeLimit=100*(:StoredLocalPower<:MaxLocalPower) goto1
//per auto cannon, unquie names
-------------------------------------------------------------------------
a=100
:FuelChamberUnitRateLimit=:generator*a-:StoredBatteryPower/a goto2
:FuelChamberUnitRateLimit=a-:StoredBatteryPower/a goto3
//Button would be called :generator here, works with or without button (make sure the button is set up before starting the script)
-------------------------------------------------------------------------
a=0 :TP=-15
If :Miner AND a!=10 THEN :TP++ a++ Goto 2 END goto 1
-------------------------------------------------------------------------
goto :Miner+1
if :TP>=-3 then goto3 else :TP++ goto2*:Miner end
if :TP<=-15 then goto2 else :TP-- goto3*:Miner end
-------------------------------------------------------------------------
:uF=:FcuForward*(.1+(:BM<1)*.9) :uB=:FcuBackward*(.1+(:BM<1)*.9) goto1
//'.1' here means we use in turtle mode only 10% thrust
//while we add to that value another '.9' (90%) when turtle mode
//is off.
-------------------------------------------------------------------------
:FcuForward=0 :FcuBackward=0
:T+=:Inc*20 :T-=:Dec*20 :T+=(:T<0)*1020 :T%=1020 goto :Approach*2+2
v=((:AL<=:AR)*:AL+(:AL>:AR)*:AR-:T)/100
:FcuForward=(v>=0)*v :FcuBackward=(v<=0)*(-v) goto :Approach*2+1
T is target distance, approach is the on off button, AL and AR are the left and right sensors
it takes the minimum of those two sensors as the distance to the target
-------------------------------------------------------------------------
if:AlarmOveride==1then:SoundOn=0 :RedLight=0 goto1end
if:DurErr>0thenalarm=1 :SndT=8 alm="Durability" goto5elsealarm=0end
if:FuelCheck<500thenalarm=1 :SndT=4 alm="Fuel" goto5elsealarm=0end
if:Propellant<500thenalarm=1 :SndT=6 alm="Prop" goto5elsealarm=0end
:SoundOn=0+alarm ifalarm then:RedLight=1-:RedLight else:Redlight=0end
ifalarm!=1then:Info="\nWarpClass: "+:WarpClass goto1 end
if alm=="Durability" then alm+=" "+:DurErr end :Info="\n"+alm goto 1
// This replaces the 2 individual alarm chips.
// Also change priority on the sound device above seat to 1 and
// radius to 50. Also change DurabilityErrors to DurErr on ship
// monitor at top of YOLOL rack stack. You can // comment out any
// alarms you dont care about (lines 2-4)
-------------------------------------------------------------------------
you can look at this fuzzy, i did it for the buffalo 3 laser system
if:Static+:Mine==0then:LTY=20 :RTY=-20 :BTP=-10 goto1end
ift<10thenif:Mine*1-:Static thent++ goto2elsegoto1endend t=0
if:LTY==20then:LTY=40 :RTY=-40 :BTP=-15 goto1end
if:LTY==40then:LTY=0 :RTY=0 :BTP=-5 goto1end
if:LTY==0then:LTY=40 :RTY=-40 :BTP=-15 goto1end
its meant to work with this
if :BTCP<-15+:BTCP:>0 then :PChk=0 end if :Mine then :turtle=10 end
if (:LTCP!=-5+:RTCP!=-5)*:PChk!=0 then :PChk=0 else :PChk=1 end
if :Mine then :turtle=10 end goto 1
// :BTCP is bottom turret current pitch, :LTCP and :RTCP are for
// top turrets. :Mine is mine button, :turtle is turtle button
// :PChk is store on memory chip (or other device)
// This, positioning and Control mining chips replace the origi
and this
if:Mine*:PChk then:MLT=1-:MLT :CL=1-:CL goto1else :MLT=0 :CL=:COLL end
if:PChk==0 then :RTP=-5 :LTP=-5 :BTP=-10 end goto 1
// :Mine is mining button, :Pchk is on a memory chip or other device
// :MLT is the first field on all lasers. :CL is first on collectors
// :COLL is collector button.
// :RTP, :LTP, :BTP is the first field on the pitch of the turrets
// for right, left and bottom lasers.
// This, Safety and positioning mining chips replace the original.
-------------------------------------------------------------------------
:p/:r is pitch/rotation on mining lasers. they're zeroed in on the same spot with another chip
z=-11 y=12 m=30 n=45 k=0
k=0 if :MLS<0 then goto5 end if :MLS>0 then goto11 end goto2
//Scrambler Mode One (+1)
i=:RD :p+=n/i if :MLS<0 then goto6 end goto2
:r+=m/i if :MLS<0 then goto7 end goto2
:p-=n/i if :MLS<0 then goto8 end goto2
:r-=m/i if :MLS<0 then goto5 end goto2
//Scrambler Mode Two (-1)
i=:RD :p+=n/i :r+=m/i if :MLS>0 then goto12 end goto2
if k<3 then :p-=n/i :r-=m/i k+=1 goto11 end k=0 :p-=n/i
i=:RD :p+=n/) :r-=m/i if :MLS>0 then goto14 end goto2
if k<3 then :p-=n/i :r+=m/i k+=1 goto13 end k=0 :r+=m/i goto11
-------------------------------------------------------------------------
//swing from left to right.
:TurretRotation=(20-40*(i++>5))*:lasers i*=i>10 :laser=:lasers goto1
-------------------------------------------------------------------------
\\ SebastianNs FuelTimer V210811
\\ Rename your FuelChamberFuel to FCF + Numbers
T=:FCF1+:FCF2+:FCF3+:FCF4+:FCF5+:FCF6+:FCF7+:FCF8 T/=8
A=T/:FuelChamberUnitRate B=A/3600/1000*1000
A=A-B*3600 C=A/60/1000*1000 A=A-C*60 D=A/1000*1000
If B<100 then If B<10 then X=" "+B else X=" "+B end else X=B end
X=X+" Hours\n" If C<10 then Y=" "+C else Y=" "+C end Y=Y+" Minutes\n"
If A<10 then Z=" "+D else Z=" "+D end
:Fuel="\n"+X+Y+Z+" Seconds remaining" goto 3
-------------------------------------------------------------------------
// Approach ahead - Mutleyx
:Approach=0 :range=0 od=0 oa=0
a=:Approach if a!=oa then oa=a :range=a end goto 3+a
d=:Distance if d!=500 then goto 6 end
:FcuForward=0 :FcuBackward=0 goto 3
if d>40 and d<50 then goto 9 end
done=0 cd=35-d dx=od-cd od=cd adj=-(cd-4.5*dx) goto 13
Line 8 empty
:FcuForward=0 :FcuBackward=0
done++ if done > 10 then :Approach = 0 end
goto 2*:Approach+2
Line 12 empty
if adj>d then adj=d end :FcuForward=0 :FcuBackward=0
if adj<0 then :FcuBackward=-adj*0.5 else :FcuForward=adj*0.25 end
if :Approach then goto 4 else goto 9 end
-------------------------------------------------------------------------
Buffalo Turret Setup - Reset & Fix
To adjust pitch, look at housing and hit U.
To adjust rotation, look at turret base and hit U.
Right mining laser:
Laser:
MiningLaser: 0 (0 for off; 1 for on)
MiningLaserBeamLength: 20
Turntable:
LTR01: -5.2 (TurretRotation)
LTCR01: -5.2 (TurretCurrentRotation)
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
LTP01: -7 (TurretPitch)
LTCP01: -7 (TurretCurrentPitch)
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
Left mining laser:
Laser:
MiningLaser: 0 (0 for off; 1 for on)
MiningLaserBeamLength: 20
Turntable:
LTR02: 5.2
LTCR02: 5.2
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
LTP02: -7
LTPC02: -7
MaxRotation: 160
MinRotation: -20
TargetVelocity: 0.2
Right collector:
Turntable:
CTR01: 0
CTCR01: 0
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
CTP01: -7
CTCP01: -7
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
Left collector:
Turntable:
CTR02: 0
CTCR02: 0
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
CTP02: -7
CTCP02: -7
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
-------------------------------------------------------------------------
//Laser Automation
if :M_Laser==1 then goto 3 end else goto 5 end
if :M_Laser==1 then :MiningLaser=1 :Collectors=1 end else goto 5 end
if :MiningLaser==0 then :MiningLaser=1 else :MiningLaser=0 goto 3 end
:MiningLaser=0 :Collectors=0
:LaserRYaw=180 :LTP01=-7 :LaserLYaw=-180 :LTP02=-7 goto 2
-------------------------------------------------------------------------
ANTI ROCK
1 if :TCAS then :RF=1 goto 2 else :RF=0 :ALM=0 goto 1 end
2 if :RFD<=999 then goto 4 else goto 1 end
3 if :TCAS==0 OR :RFD>999 then goto 5 else goto 3 end
4 :FCUForward=0 :FCUBackward=100 :FCUUpDown=-100 :ALM=1 goto 3
5 :FCUBackward=0 :FCUUpDown=0 :ALM=0 if :Cruise then :FCUForward=100 end
6 goto 1
-------------------------------------------------------------------------
// Variables for Tweaking
a = 9500 // If Battery Amount is lower than this, Gen is 100%
b = 10 // If Button is On, Gen will be at least this much
// Static variables and precalculation
c = 10000 // Max Stored Battery Power
d = 100 // 100%
e=(c-a)/d f=(d/b)
// Final Generator Scriptline
:Gen=:On*(((:Bat<a)*d)+((:Bat>a)*(((:Bat-c)*-1)+(:Bat-a)/f)/e)) goto 9
-------------------------------------------------------------------------
r=0 c=9800 b=:Battery
r=(c-b)/10 :generatorUnitRateLimit+=1.3*r b=:Battery GOTO1
-------------------------------------------------------------------------
:GeneratorRate=(10000-:Battery)/100+:(GenBoost*100) goto 1
-------------------------------------------------------------------------
If :bat>9800 then :UnitRateLimit=(10000-:bat)/2 else :UnitRateLimit=100 end
-------------------------------------------------------------------------
r=0 c=9800 b=:Battery
r=(c-b)/10 :gen+=1.3*r
IF :Turtle != 100 then GOTO4 ELSE GOTO5 END
:LeverBindsMoveSpeed=0.2 GOTO6
:LeverBindsMoveSpeed=10 GOTO6
b=:Battery GOTO2
-------------------------------------------------------------------------
C=":"
T=:Rodtime H=(T-T%3600)/3600 T%=3600 M=(T-T%60)/60 T%=60 S=(T-T%1)
:Fdis="\nFuel Rods:\n"+H+C+M+C+S goto2
-------------------------------------------------------------------------
//Scanner script
i=0 Scan="" Vol="\n" :Mats="Nothing detected!"
:Vol=:Mats :Ind=i :Res=i
if :Scan==1 then goto5 end else goto 2 end
:Materials="<Analysing>" :Volume="<Analysing>" :CW=5
:Ind=i Scan=Scan+:Mats+"\n" Vol=Vol+:Vol+"\n"
:Materials=Scan :Volume=Vol i++
if :Res<=i then :Scan=0 goto2 end else goto6 end
-------------------------------------------------------------------------
//scanner 2
if :Scanner>0 then goto 3 else end goto 2
:Scanning="Scanner Offline" goto 1
:Scan=1 :index=0 L1=:Material-" ore"+"\n"+(:Volume/1728)
:index=1 L2="\n"+:Material-" ore"+"\n"+(:Volume/1728) :Scanning=L1+L2
goto 1
-------------------------------------------------------------------------
//scanner 3
n="\n" ns="\n " k="kv" i=0 R="" proc="Processing" nt="No target"
IF :Scanner<1 THEN GOTO2 END :Scan=1
IF :rslt==0 THEN:Result=n+nt GOTO2 END :Result=n+proc
:Scanner=0 IF i<:rslt THEN :idx=i R+=:mat+ns+:vol+k+n i+=1 GOTO4 END
:Result=n+R :ResetScanner=1 GOTO1
-------------------------------------------------------------------------
//scanner 4
b=" Ore" c=" Crystal" d="\n" ifnot :Scanner thengoto1end
ifnot :Volume then:Scan=1 goto2end e=0 f=""
ife<:n then:Index=e f+=:Material-b-c+d+:Volume/1728+d e++ goto3end
ifnot :Continuous then:Scanner=0end :Reset=1 :Scanned=f goto1
Device fields must be standard except for Active -> Scanner and ScanResults -> n.
Name your text panel Scanned and set up buttons for Scanner and Continuous.
Results output in number of inventory stacks, not in raw kv
-------------------------------------------------------------------------
//scanner 5
MATERIAL SCANNER SETUP
Display (Must be 24 x 24 Multiline Display)
MTxt
Button
Sense
Scanner
Sense
Idx
Rslt
Mat
Vol
Scan
Reset
Yolol Script
IF :Sense then :Scan=1 GOTO2 ELSE :MTxt="Offline" GOTO1 END
i=0 n="\n" IF :Rslt==0 THEN :MTxt="?" GOTO1 ELSE D="" GOTO3 END
:idx=i L1=:Mat-" Ore"-" Crystal"+n+(:Vol/1728)+n i+=1
:IF i<:Rslt THEN GOTO3 ELSE :MTxt=D GOTO1 END
-------------------------------------------------------------------------
If :MatScan then :Scan=1 goto2 else :Scanner="\nOffline" goto1 end
i=0 n="\n" if :res==0 then :Scanner="\nNo Result" goto1 else D="" end
:ind=i D+=:mat-" Ore"-" Crystal"+n+(:vol/1728)+n i+=1
if i<:res then goto3 else :Scanner=D goto1 end
-------------------------------------------------------------------------
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stacks"
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto2
if:Scanner thenif:Scan==1thengoto3endelse:Scn="Offline" goto2end
:i=0 if:V==0then:Scn=b+"No Contact" goto2end
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o t=0
if:Scanner thenift<20thent++ goto8endelse:Scn="Offline" goto2end
// Scanner is first field name on Button and :Scanner
// Scn is first field name of Text Display
// On Scanner, rename Volume field to V, Material field to M, and
// Index field to i All other fields on scanner are default.
-------------------------------------------------------------------------
lP=:Propellant lF=:Fuel i=0
if i++ < 24 then goto 2 end
p=:Propellant f=:Fuel
tc=((i*0.2)+2) dP=(lP-p)/tc dF=(lF-f)/tc
pM=(p/dP)/60 fM=(f/dF)/60
:TimeLeft="\n\nFuel Time: "+fM+"m"+"\nProp Time: "+pM+"m" goto 1
-------------------------------------------------------------------------
if :MiningMode thengoto2else :TR1=-90 :TR2=90 :TP1=90 :TP2=90 goto1end
:TR1=:TRC1-(-90*:MiningOn) :TR2=:TRC2-(90*:MiningOn) goto1
-------------------------------------------------------------------------
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stks" :reset=1
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto1
if:Scanner thenif:Scan thengoto4endelse:Scn="Offline" goto1end
:i=0 if:V==0then:Scn=b+"Scanning.." goto2end :Scn="Analyzing"
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o
:Scanner=0 goto1
-------------------------------------------------------------------------
o=" Ore" c=" Crystal" n="\n" f="" :Scan=1/(1-:Volume*:Scanner>0) goto1
f+=:Material-o-c+n+:Volume/1728+n goto3-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto1
// Rename `Active` -> `Scanner` on your Material Point Scanner, set up
// a text panel `Scanned`, an activation button `Scanner`, and a
// button `Continuous` to toggle between single and continuous scans.
-------------------------------------------------------------------------
p=-1.6 a=2.45 b=0.571 c=57.295 d=1.571
o=:RFD+p t=o/a :CA=(b*t+t*t)/(1+2*b*t+t*t)*c*d goto2
// Basic-chip arctangent calculation takes rangefinder distance :RFD
// and outputs appropriate convergence angle :CA. It has tunables -
//
// p (opposite-offset) - how far forward/back your rangefinder is
// in relation to the hinge point of the lasers.
//
// a (adjacent) - how far off to the side your lasers' hinge point
// is in relation to the rangefinder beam.
-------------------------------------------------------------------------
a=1000 b=3600 c=a*b d=":" e="\nfuel time:\n"
ft=:fuel/(:fuelrate*75/100) r=(hy-:hydrogen)/0.84 hy=:hydrogen ht=hy/r
fh=ft/c*a fm=(ft-fh*b)/60/a*a fs=(ft-fh*b-fm*60)/a*a
gh=ht/c*a gm=(ht-gh*b)/60/a*a gs=(ht-gh*b-gm*60)/a*a
:flow=e+fh+d+fm+d+fs+"\nhydro time:\n"+gh+d+gm+d+gs goto2
Fuel rod remaining = :fuel
Fuel rod flow rate = :fuelrate
Gas network stored = :hydrogen
display = :flow
single basic chip
-------------------------------------------------------------------------
r=:RFD e=r-s d=e-p i+=e/(d-g) i/=2 o=Kp*e+Ki*i+Kd*d p=e r*=r<m
z/=:Approach*r*(d*d>g+e*e>1) :FcuForward=o/t :FcuBackward=-o*t goto2
-------------------------------------------------------------------------
j="\nMat|Stacks" o=j a=" Ore" b="\n" d="♥" e="♡" h="ium" TO=20
:autoscan-=s s=e :autoscan=s+:autoscan f=1728000 :Re=1 :L=0 goto2+:AS
:autoscan-=s s=d :autoscan=s+:autoscan g="ite" i=0 :I=0 :L=1 :R=0 :S=1
tv=0 o=j c=" Crystal" i++ if i>TO then :L=0 goto9 end goto5-:S
:L=0 i/=:R :I=0 v=:V/f*1000 tv+=v o+=b+"① "+(:M-a-c-g-h)+"|"+v
i/=:R :I=1 v=:V/f*1000 tv+=v o+=b+"② "+(:M-a-c-g-h)+"|"+v
i/=:R v=tv at="\nCLass:"+(4+v>10+v>11+v>18+v>26+v>124+v>270)
i/=:R :autoscan=s+o+b+"Total Stacks:"+tv+at :S=0 :Re=1 goto2+:AS
w="\n !WARNING!" i/=:R :autoscan=s+w+"\n\n «TIMEOUT»\n"+w goto2+:AS
:autoscan=s+w+"\n\n Nothing\n Found\n"+w goto2+:AS
-------------------------------------------------------------------------
y=17280 s=":\n" f=" stacks\n" h=10 z="\n" b="" t=150 x=0
c=" Crystals" o=" Ore"
if:scanner==0 thengoto3+(++x>t)*4 end:sR=1 :sS=1 r=z q=z :LastScan=b
a=:sc>0or:ss==0 ifathenr+=:sM-c-o+s+:sV/y*h+f :i++endgoto4+(:i>=:sC)*a
if:sc==0 or:ss==1 then :sr=1 :ss=0 goto2end :LastScan=r :scanner=0
:sS=0 :sR=1 goto1
x=0 :LastScan="" goto3
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stacks" :reset=1
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto1
if:Scanner thenif:Scan thengoto3endelse:Scn="Offline" goto1end
:i=0 if:V==0then:Scn=b+"No Contact" goto2end
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o t=0
if:Scanner thenift<20thent++ goto8endelse:Scn="Offline" goto1end
// Scanner is first field name on Button and :Scanner
// Scn is first field name of Text Display
// On Scanner, rename Volume field to V, Material field to M, and
// Index field to i
-------------------------------------------------------------------------
b=" Ore" c=" Crystal" d="\n" v=1728
f="" :Scan=1/(1-:Volume*:Scanner>0) goto2
f+=:Material-b-c+d+:Volume/v+d goto4-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto2
-------------------------------------------------------------------------
So Ardyn gave me an approach script and I fitted it to the Quadugon so just wanted to share this.
I'm sure this could be condensed but it is working for me.
Notes:
d=Distance you Want Away from an Asteroid
a=Approach Speed
Button named Approach Required(You can change the name the script looks for if you want)
Recommend Binding the Button to a hotkey
Distance is the distance you will see on the foldout panel for Mining
If you aren't in mining mode Approach will be disabled, you can remove the line if you want.
Device Changes:
Change the RangeFinder above the Pilot Seat to look further than 500
Install a Chip Socket and Yolol Chip(Basic or Advanced( plus data line for it.
Replace or add a Button for Approach
Code:
r=:Distance d=15 a=15
if :MiningMode==0 then :Approach=0 goto1 end //Remove if Desired
if :Approach==0 then :FcuBackward=0 goto1 end
if (r<d) then :Approach=0 goto7 end
if 1-(1<r)*(r<500)*:Approach thengoto1end
:FcuForward=(r>d)*(r-d)/a goto1
:FcuBackward=(r<d)*(-100*r/d+100) goto1
-------------------------------------------------------------------------
b=" Ore" c=" Crystal" d="\n" v=1728
f="" :Scan=1/(1-:Volume*:Scanner>0) goto2
f+=:Material-b-c+d+:Volume/v+d goto4-:Index++<:ScanResults
:Scanner*=:Continuous :Reset=1 :Scanned=f goto2
Which expects an activation button in your cockpit called Scanner (to enable/disable it),
another button called Continuous (to toggle whether the beam should keep rescanning or stop/disable
itself after it's found something), and a text pannel called Scanned.
-------------------------------------------------------------------------
if Not :Laser then goto1 end
:TP= 90 if :Curr2 < 73 then goto1 end :LA = 1 :TV=0.3
:TR1 = :Curr1+180 :TR3 = :Curr3-180 if Not :Laser then goto5 end
if:TP>:Radius then :TP--else :TP=95 end :La=1 goto3
:TV=100 :TR1=0 :TR3=0 :TP=0 :LA = 0 goto1
-------------------------------------------------------------------------
m=:Mine a=:Auto :TTP=-10*m :BTP=-10*m goto2
g=(:GeneratorUnitRate>=50) :MineR=g goto (g==m)+(a*2)
m=:Mine a=:Auto :TTR-- :BTR-- :TTP++ :BTP++ goto m*a*3+i++>19
m=:Mine a=:Auto :TTR++ :BTR++ :TTP-- :BTP-- goto m*a*4+i++>39
m=:Mine a=:Auto :TTR-- :BTR-- :TTP-- :BTP-- goto m*a*5+i++>59
m=:Mine a=:Auto :TTR-- :BTR-- :TTP++ :BTP++ goto m*a*6+i++>79
i=0 :TTP=-10*m :BTP=-10*m :TTR=m :BTR=m goto1
-------------------------------------------------------------------------
a=1000 b=60 c=3600
RT="inf" RT=:Rod/(R-:Rod) R=:Rod
h=RT/c/a*a m=(RT-h*c)/b/a*a s=(RT-h*c-m*b)/a*a RT=h+":"+m+":"+s
PT="inf" PT=:Prop/(P-:Prop) P=:Prop
h=PT/c/a*a m=(PT-h*c)/b/a*a s=(PT-h*c-m*b)/a*a PT=h+":"+m+":"+s
:RodTime="\n\n "+RT+"\nPropTime:\n "+PT goto 2
// Change FuelChamberFuel to Rod, GasNetworkStoredResource to Prop
// Text panel, RodTime
// Required> Basic
-------------------------------------------------------------------------
:AutocannonChargeLimit=100*(:StoredLocalPower<:MaxLocalPower) goto1
//per auto cannon, unquie names
-------------------------------------------------------------------------
a=100
:FuelChamberUnitRateLimit=:generator*a-:StoredBatteryPower/a goto2
:FuelChamberUnitRateLimit=a-:StoredBatteryPower/a goto3
//Button would be called :generator here, works with or without button (make sure the button is set up before starting the script)
-------------------------------------------------------------------------
a=0 :TP=-15
If :Miner AND a!=10 THEN :TP++ a++ Goto 2 END goto 1
-------------------------------------------------------------------------
goto :Miner+1
if :TP>=-3 then goto3 else :TP++ goto2*:Miner end
if :TP<=-15 then goto2 else :TP-- goto3*:Miner end
-------------------------------------------------------------------------
:uF=:FcuForward*(.1+(:BM<1)*.9) :uB=:FcuBackward*(.1+(:BM<1)*.9) goto1
//'.1' here means we use in turtle mode only 10% thrust
//while we add to that value another '.9' (90%) when turtle mode
//is off.
-------------------------------------------------------------------------
:FcuForward=0 :FcuBackward=0
:T+=:Inc*20 :T-=:Dec*20 :T+=(:T<0)*1020 :T%=1020 goto :Approach*2+2
v=((:AL<=:AR)*:AL+(:AL>:AR)*:AR-:T)/100
:FcuForward=(v>=0)*v :FcuBackward=(v<=0)*(-v) goto :Approach*2+1
T is target distance, approach is the on off button, AL and AR are the left and right sensors
it takes the minimum of those two sensors as the distance to the target
-------------------------------------------------------------------------
if:AlarmOveride==1then:SoundOn=0 :RedLight=0 goto1end
if:DurErr>0thenalarm=1 :SndT=8 alm="Durability" goto5elsealarm=0end
if:FuelCheck<500thenalarm=1 :SndT=4 alm="Fuel" goto5elsealarm=0end
if:Propellant<500thenalarm=1 :SndT=6 alm="Prop" goto5elsealarm=0end
:SoundOn=0+alarm ifalarm then:RedLight=1-:RedLight else:Redlight=0end
ifalarm!=1then:Info="\nWarpClass: "+:WarpClass goto1 end
if alm=="Durability" then alm+=" "+:DurErr end :Info="\n"+alm goto 1
// This replaces the 2 individual alarm chips.
// Also change priority on the sound device above seat to 1 and
// radius to 50. Also change DurabilityErrors to DurErr on ship
// monitor at top of YOLOL rack stack. You can // comment out any
// alarms you dont care about (lines 2-4)
-------------------------------------------------------------------------
you can look at this fuzzy, i did it for the buffalo 3 laser system
if:Static+:Mine==0then:LTY=20 :RTY=-20 :BTP=-10 goto1end
ift<10thenif:Mine*1-:Static thent++ goto2elsegoto1endend t=0
if:LTY==20then:LTY=40 :RTY=-40 :BTP=-15 goto1end
if:LTY==40then:LTY=0 :RTY=0 :BTP=-5 goto1end
if:LTY==0then:LTY=40 :RTY=-40 :BTP=-15 goto1end
its meant to work with this
if :BTCP<-15+:BTCP:>0 then :PChk=0 end if :Mine then :turtle=10 end
if (:LTCP!=-5+:RTCP!=-5)*:PChk!=0 then :PChk=0 else :PChk=1 end
if :Mine then :turtle=10 end goto 1
// :BTCP is bottom turret current pitch, :LTCP and :RTCP are for
// top turrets. :Mine is mine button, :turtle is turtle button
// :PChk is store on memory chip (or other device)
// This, positioning and Control mining chips replace the origi
and this
if:Mine*:PChk then:MLT=1-:MLT :CL=1-:CL goto1else :MLT=0 :CL=:COLL end
if:PChk==0 then :RTP=-5 :LTP=-5 :BTP=-10 end goto 1
// :Mine is mining button, :Pchk is on a memory chip or other device
// :MLT is the first field on all lasers. :CL is first on collectors
// :COLL is collector button.
// :RTP, :LTP, :BTP is the first field on the pitch of the turrets
// for right, left and bottom lasers.
// This, Safety and positioning mining chips replace the original.
-------------------------------------------------------------------------
:p/:r is pitch/rotation on mining lasers. they're zeroed in on the same spot with another chip
z=-11 y=12 m=30 n=45 k=0
k=0 if :MLS<0 then goto5 end if :MLS>0 then goto11 end goto2
//Scrambler Mode One (+1)
i=:RD :p+=n/i if :MLS<0 then goto6 end goto2
:r+=m/i if :MLS<0 then goto7 end goto2
:p-=n/i if :MLS<0 then goto8 end goto2
:r-=m/i if :MLS<0 then goto5 end goto2
//Scrambler Mode Two (-1)
i=:RD :p+=n/i :r+=m/i if :MLS>0 then goto12 end goto2
if k<3 then :p-=n/i :r-=m/i k+=1 goto11 end k=0 :p-=n/i
i=:RD :p+=n/) :r-=m/i if :MLS>0 then goto14 end goto2
if k<3 then :p-=n/i :r+=m/i k+=1 goto13 end k=0 :r+=m/i goto11
-------------------------------------------------------------------------
//swing from left to right.
:TurretRotation=(20-40*(i++>5))*:lasers i*=i>10 :laser=:lasers goto1
-------------------------------------------------------------------------
\\ SebastianNs FuelTimer V210811
\\ Rename your FuelChamberFuel to FCF + Numbers
T=:FCF1+:FCF2+:FCF3+:FCF4+:FCF5+:FCF6+:FCF7+:FCF8 T/=8
A=T/:FuelChamberUnitRate B=A/3600/1000*1000
A=A-B*3600 C=A/60/1000*1000 A=A-C*60 D=A/1000*1000
If B<100 then If B<10 then X=" "+B else X=" "+B end else X=B end
X=X+" Hours\n" If C<10 then Y=" "+C else Y=" "+C end Y=Y+" Minutes\n"
If A<10 then Z=" "+D else Z=" "+D end
:Fuel="\n"+X+Y+Z+" Seconds remaining" goto 3
-------------------------------------------------------------------------
// Approach ahead - Mutleyx
:Approach=0 :range=0 od=0 oa=0
a=:Approach if a!=oa then oa=a :range=a end goto 3+a
d=:Distance if d!=500 then goto 6 end
:FcuForward=0 :FcuBackward=0 goto 3
if d>40 and d<50 then goto 9 end
done=0 cd=35-d dx=od-cd od=cd adj=-(cd-4.5*dx) goto 13
Line 8 empty
:FcuForward=0 :FcuBackward=0
done++ if done > 10 then :Approach = 0 end
goto 2*:Approach+2
Line 12 empty
if adj>d then adj=d end :FcuForward=0 :FcuBackward=0
if adj<0 then :FcuBackward=-adj*0.5 else :FcuForward=adj*0.25 end
if :Approach then goto 4 else goto 9 end
-------------------------------------------------------------------------
Buffalo Turret Setup - Reset & Fix
To adjust pitch, look at housing and hit U.
To adjust rotation, look at turret base and hit U.
Right mining laser:
Laser:
MiningLaser: 0 (0 for off; 1 for on)
MiningLaserBeamLength: 20
Turntable:
LTR01: -5.2 (TurretRotation)
LTCR01: -5.2 (TurretCurrentRotation)
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
LTP01: -7 (TurretPitch)
LTCP01: -7 (TurretCurrentPitch)
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
Left mining laser:
Laser:
MiningLaser: 0 (0 for off; 1 for on)
MiningLaserBeamLength: 20
Turntable:
LTR02: 5.2
LTCR02: 5.2
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
LTP02: -7
LTPC02: -7
MaxRotation: 160
MinRotation: -20
TargetVelocity: 0.2
Right collector:
Turntable:
CTR01: 0
CTCR01: 0
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
CTP01: -7
CTCP01: -7
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
Left collector:
Turntable:
CTR02: 0
CTCR02: 0
MaxRotation: 180
MinRotation: -180
TargetVelocity: 0.1
Cradle:
CTP02: -7
CTCP02: -7
MaxRotation: 180
MinRotation: -20
TargetVelocity: 0.2
-------------------------------------------------------------------------
//Laser Automation
if :M_Laser==1 then goto 3 end else goto 5 end
if :M_Laser==1 then :MiningLaser=1 :Collectors=1 end else goto 5 end
if :MiningLaser==0 then :MiningLaser=1 else :MiningLaser=0 goto 3 end
:MiningLaser=0 :Collectors=0
:LaserRYaw=180 :LTP01=-7 :LaserLYaw=-180 :LTP02=-7 goto 2
-------------------------------------------------------------------------
ANTI ROCK
1 if :TCAS then :RF=1 goto 2 else :RF=0 :ALM=0 goto 1 end
2 if :RFD<=999 then goto 4 else goto 1 end
3 if :TCAS==0 OR :RFD>999 then goto 5 else goto 3 end
4 :FCUForward=0 :FCUBackward=100 :FCUUpDown=-100 :ALM=1 goto 3
5 :FCUBackward=0 :FCUUpDown=0 :ALM=0 if :Cruise then :FCUForward=100 end
6 goto 1
-------------------------------------------------------------------------
// Variables for Tweaking
a = 9500 // If Battery Amount is lower than this, Gen is 100%
b = 10 // If Button is On, Gen will be at least this much
// Static variables and precalculation
c = 10000 // Max Stored Battery Power
d = 100 // 100%
e=(c-a)/d f=(d/b)
// Final Generator Scriptline
:Gen=:On*(((:Bat<a)*d)+((:Bat>a)*(((:Bat-c)*-1)+(:Bat-a)/f)/e)) goto 9
-------------------------------------------------------------------------
r=0 c=9800 b=:Battery
r=(c-b)/10 :generatorUnitRateLimit+=1.3*r b=:Battery GOTO1
-------------------------------------------------------------------------
:GeneratorRate=(10000-:Battery)/100+:(GenBoost*100) goto 1
-------------------------------------------------------------------------
If :bat>9800 then :UnitRateLimit=(10000-:bat)/2 else :UnitRateLimit=100 end
-------------------------------------------------------------------------
r=0 c=9800 b=:Battery
r=(c-b)/10 :gen+=1.3*r
IF :Turtle != 100 then GOTO4 ELSE GOTO5 END
:LeverBindsMoveSpeed=0.2 GOTO6
:LeverBindsMoveSpeed=10 GOTO6
b=:Battery GOTO2
-------------------------------------------------------------------------
C=":"
T=:Rodtime H=(T-T%3600)/3600 T%=3600 M=(T-T%60)/60 T%=60 S=(T-T%1)
:Fdis="\nFuel Rods:\n"+H+C+M+C+S goto2
-------------------------------------------------------------------------
//Scanner script
i=0 Scan="" Vol="\n" :Mats="Nothing detected!"
:Vol=:Mats :Ind=i :Res=i
if :Scan==1 then goto5 end else goto 2 end
:Materials="<Analysing>" :Volume="<Analysing>" :CW=5
:Ind=i Scan=Scan+:Mats+"\n" Vol=Vol+:Vol+"\n"
:Materials=Scan :Volume=Vol i++
if :Res<=i then :Scan=0 goto2 end else goto6 end
-------------------------------------------------------------------------
//scanner 2
if :Scanner>0 then goto 3 else end goto 2
:Scanning="Scanner Offline" goto 1
:Scan=1 :index=0 L1=:Material-" ore"+"\n"+(:Volume/1728)
:index=1 L2="\n"+:Material-" ore"+"\n"+(:Volume/1728) :Scanning=L1+L2
goto 1
-------------------------------------------------------------------------
//scanner 3
n="\n" ns="\n " k="kv" i=0 R="" proc="Processing" nt="No target"
IF :Scanner<1 THEN GOTO2 END :Scan=1
IF :rslt==0 THEN:Result=n+nt GOTO2 END :Result=n+proc
:Scanner=0 IF i<:rslt THEN :idx=i R+=:mat+ns+:vol+k+n i+=1 GOTO4 END
:Result=n+R :ResetScanner=1 GOTO1
-------------------------------------------------------------------------
//scanner 4
b=" Ore" c=" Crystal" d="\n" ifnot :Scanner thengoto1end
ifnot :Volume then:Scan=1 goto2end e=0 f=""
ife<:n then:Index=e f+=:Material-b-c+d+:Volume/1728+d e++ goto3end
ifnot :Continuous then:Scanner=0end :Reset=1 :Scanned=f goto1
Device fields must be standard except for Active -> Scanner and ScanResults -> n.
Name your text panel Scanned and set up buttons for Scanner and Continuous.
Results output in number of inventory stacks, not in raw kv
-------------------------------------------------------------------------
//scanner 5
MATERIAL SCANNER SETUP
Display (Must be 24 x 24 Multiline Display)
MTxt
Button
Sense
Scanner
Sense
Idx
Rslt
Mat
Vol
Scan
Reset
Yolol Script
IF :Sense then :Scan=1 GOTO2 ELSE :MTxt="Offline" GOTO1 END
i=0 n="\n" IF :Rslt==0 THEN :MTxt="?" GOTO1 ELSE D="" GOTO3 END
:idx=i L1=:Mat-" Ore"-" Crystal"+n+(:Vol/1728)+n i+=1
:IF i<:Rslt THEN GOTO3 ELSE :MTxt=D GOTO1 END
-------------------------------------------------------------------------
If :MatScan then :Scan=1 goto2 else :Scanner="\nOffline" goto1 end
i=0 n="\n" if :res==0 then :Scanner="\nNo Result" goto1 else D="" end
:ind=i D+=:mat-" Ore"-" Crystal"+n+(:vol/1728)+n i+=1
if i<:res then goto3 else :Scanner=D goto1 end
-------------------------------------------------------------------------
b="\n" o=" Ore" c=" Crystal" k=100 s=" Stacks"
if:Scanner then:Scn=b+"Scanning..." :Scan=1 goto3end goto2
if:Scanner thenif:Scan==1thengoto3endelse:Scn="Offline" goto2end
:i=0 if:V==0then:Scn=b+"No Contact" goto2end
V1=:V/1728 V=(V1+0.05)/k*k L1=:M-o-c+b+V+s
:i=1 V2=:V/1728 V=(V2+0.05)/k*k L2=b+:M-o-c+b+V+s
P=V2/V1*100 :Scn="Result"+b+L1+L2+b+b+P+"%"+o t=0
if:Scanner thenift<20thent++ goto8endelse:Scn="Offline" goto2end
// Scanner is first field name on Button and :Scanner
// Scn is first field name of Text Display
// On Scanner, rename Volume field to V, Material field to M, and
// Index field to i All other fields on scanner are default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment