Space Engineers

Space Engineers

Firing Sequencer
51 Comments
FoxBall  [author] 22 Jun, 2021 @ 5:50pm 
ngl im kind of amazed it has kept working. i havent checked on it myself in quite some time
DMMWolf 10 Jan, 2021 @ 3:25pm 
And reloading save fixed issue. Love how this script is 5 years old and still valid
DMMWolf 10 Jan, 2021 @ 3:22pm 
Trying to see if I can still get this to work, doesnt seem to be doing so.
FoxBall  [author] 18 Jun, 2015 @ 3:21pm 
@gornyamaniac i recently tried to update the description but it appears that editing descriptions is currently broken
gornyakmaniac 17 Jun, 2015 @ 9:26pm 
But easy understandable description of it would be nice
gornyakmaniac 17 Jun, 2015 @ 9:11pm 
Very good script for effective firing, and simple enough to tune-up, thank you!
FoxBall  [author] 11 Jun, 2015 @ 4:20pm 
@Tiger the current version of the script requires some rather unintuitive components to work properly, my appologies for not makeing a proper tutorial,the last time i checked it it seems to have worked normally. you may be able to get it working through reading through the comments as i have NOT updated the description to the current setup instructions
Tiger 10 Jun, 2015 @ 4:24pm 
I built an experimental fighter the other day with an array of six standard rocket launchers on it, and struggled for hours to get this script to do anything at all. Finally got it working when I set the delay to .012, and used a timer block as the toggle...

...and today, after opening that world again, the scipt is completely broken yet again. Nothing at all changed, but it doesn't work at all. Very disappointed. :(
FoxBall  [author] 18 May, 2015 @ 11:18pm 
@Yutani I agree with you there, the sound of large weaponry firing is quite something. For demonstrational purposes I put a few 1500mm cannons (https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=396836524) on my ship. Needless to say my ears were ringing for a while afterwords, but it was well worth it.
Reverend Revenant 17 May, 2015 @ 7:44pm 
Yeah, I figured implementing it would be a royal pain. And it's true the more rounds downrange the better. I just like the visceral feel of the BOOM. If only someone could get the sound of the Iowa-Class 16 inch guns in game. Those things are LOUD. Yes, I know there's a naval gun mod, but I don't think the modder put in the sound.
FoxBall  [author] 16 May, 2015 @ 11:41pm 
@Yutani I'l be honest here I have no idea what the order it uses is, though it may be possible to sort the weapons array by number (the number the game automatically puts on the end when there are multiple of a block) but that kind of string manipulation is truly royal pain I do not wish to deal with at the moment. (But I might implement this in the future)

As for the for the firing rate of the 25cm Rak, the optimal tuning value is the highest value that can be given while still having the weapons fire consistently.
mathematically speaking, this value can be calculated as

[firing rate] = 1/([reload time (in seconds) for specific gun]*100)

For example: the large ship railgun has a timing of 0.001f because
0.001 = 1/(10sec*100)

(Most of the time however the modders don't post how long it takes the gun to reload, forcing us to manually find out)
[continued]...
FoxBall  [author] 16 May, 2015 @ 11:39pm 
[part 2]
Though sure a weapon may feel more powerful when it fires slower, however the actual effectiveness of the weapon goes down as it is sending less rounds towards the target.

As an example, let's say we have a hypothetical weapon which when fired deals 300 damage (in some RPG combat system), and takes 6 seconds to reload.

If we fire it once every 7 seconds, we will be dealing roughly 42.8 damage per second.
However, the weapon only takes 6 seconds to reload! It sits idle for a whole second before firing, and if we were to instead fire it once every 6 seconds, we will be dealing 50 damage per second. the more guns we add, the worse this DPS deficit gets.

At the end of the day however, the timings are really a personal preference (and as you can probably tell I prefer performance above just about everything) and as such you are welcome to use lower values if you feel they are more balanced and less overpowered.
Reverend Revenant 14 May, 2015 @ 10:55pm 
It seems to fire in a random order from time to time. Don't get me wrong, its still fantastic, but is there a way to set up a firing line, via naming the gun appropriately or something?

Also, if you ask me the 25cm Rak Should have a rate of 0.0009 instead of 0.0016 to feel slower and thus more powerful.
FoxBall  [author] 29 Apr, 2015 @ 11:14pm 
ex: your timer block is named "cycleA", the variable SEQ_TIMERBLOCK should also be "cycleA" etc etc... i REALLY ought to do a video on this thing
FoxBall  [author] 29 Apr, 2015 @ 11:11pm 
object not found means you entered one of the names wrong in one of the scripts. make sure the program has the correct names in it that match thier ascociated blocks.
Professor Nipples 29 Apr, 2015 @ 10:43pm 
I'm getting an object not found, not in the compiler, in the prgm block after its run
FoxBall  [author] 29 Apr, 2015 @ 10:10pm 
did the scripts show any errors?
Professor Nipples 29 Apr, 2015 @ 5:52pm 
Hey man...I am a script idot and this one is apparently no different. Monk was helping me but our hours changed up and now I come to you...on the verge of saying fuck it. lol

two banks of 25 RAK (port and strb).

I made two prgm blocks (A and B)
Two timers sequenerCyclerA and B
two toggle switches sequenceToggle A and B.

Put the prgm block into the timers (run them) and set the light on the hotbar. I toggle it on...all 5 fire...toggle it off...all 5 fire. :( What am I doing wrong here. Changed the names in code to reference the addition to the A and B. Rak Banks are named A and B as well.

Please help...I need to feel accomplished in at least one thing tonight on this damn game! lol
FoxBall  [author] 29 Apr, 2015 @ 3:46pm 
@choice thanks, i'l add that to the list of presets
Choice 29 Apr, 2015 @ 4:50am 
Great script! The frequency for large rocket launchers is about 0.06 for anyone wondering.
Reverend Revenant 28 Apr, 2015 @ 5:58pm 
Ah thanks, I'll try it out
FoxBall  [author] 28 Apr, 2015 @ 3:26pm 
@Yutani edit the declaration of gun_name at the top of the script if you want to change its name. also there is a possibility you missed the toggle, which is now a required thing hard-coded into the system. i may make it optional at a later date if i can find a reasonable way to do so.

i set up the code such that nothing past the first 4 variable declarations needs to be modified. i have no idea what exactly you managed to do to cause that particular error. but in the future, this is how you set the name of a gun.

const string GUN_NAME = "your gun's name in quotes";

it is the first line of the second set of lines (line 5).
by default the line will read:

const string GUN_NAME = "Heavy Cannon 1500mm";

i hope that solves your problem, otherwise you may have found some underlying bug
Reverend Revenant 28 Apr, 2015 @ 3:04pm 
When I try to edit all the GUN_NAME strings I get an error about Line 27 : invalid expression term ','
amd the same for Line 41
Reverend Revenant 27 Apr, 2015 @ 6:47pm 
You mean we can get a battleship broadside barrage (hehe) in a line of rolling fire? GOD BLESS YOUR SOUL
EntropicMonk 25 Apr, 2015 @ 6:27pm 
OMG thank you for that. You are a saint. It works beautifully, and is much more user-friendly.
FoxBall  [author] 25 Apr, 2015 @ 5:48pm 
side note: it is not required to enter the full name of the gun, the name field uses a search to find the guns and will find the gun if any part of the name matches. ex: "8.8 cm RaK" will match both "8.8 cm RaK 11 APCR" and "8.8 cm RaK 11 HEKC", however "APCR" will only match the former.
FoxBall  [author] 25 Apr, 2015 @ 5:41pm 
UPDATE: i have published a new version of the sequencer with integrated instant toggle functionality between sequenced and normal. the toggle block itself may be any block that can be switched on/off. there is a variable to control it/change its name in an identical manner to the cycler timer. by default it is named "sequencerToggle". note that the sequencer must be started up uppon world load however, but only needs starting once per load. to control the toggle, turn it on or off, on being sequenced, off being normal, in this way it doubles as an indicator.
lonsvghrt 25 Apr, 2015 @ 10:03am 
Side note: used four cannon with sequencer
lonsvghrt 25 Apr, 2015 @ 9:52am 
Good results with OKI's 230mm Battlecannon and const float TIME_STEP = 0.002f;
EntropicMonk 24 Apr, 2015 @ 1:24am 
Here's what I did:

Rapid Fire timer (one on hotbar): prog block on, sequencerCycler start, timer #2 on / off

Timer #2: prog block off, weapons on

sequencerCycler: prog block run, sequencerCycler start, timer #2 trigger now


It only worked for me when i used the sequencerCycler to turn the prog block off / weapons on, which is why i think it's being triggered one last time. Works great like this, though. Doesn't even need to be primed the first time (sequencer 'start' command included in rapid fire toggle).

I think the only reason your solution didnt work on my setup was the extremely short window it had to hit? Not really sure. If anyone has an issue with it, maybe they can try mine as a Plan B.
EntropicMonk 24 Apr, 2015 @ 1:02am 
@aaaddd4747: Okay, tried your suggestions and jarheads, couldnt make those work correctly, but I did finally solve it. I'm a little fuzzy on what it's doing, but i think the sequencer timer is set so fast that it's triggering the prog block one last time even though it's in the process of being cut off.

So for the record, the goal for me is an instant(ish) toggle, preferably with only one hotbar slot.
FoxBall  [author] 23 Apr, 2015 @ 1:02am 
@extropicMonk, after some quick late-night testing, i came up with a rather simple method to make a mode toggle.

you need 2 timer blocks, which i will call A, and B, you will also need two slots available in your cockpit's hotbar.

enter this for A:
program block -> off
B -> trigger now (turns out SE has a funny idea of "now", the delay is not much, but its enough)

enter this for B:
program block -> on (this resets it for later)
[gun group] -> on

as for your hotbar, add these actions:
A -> trigger now
program block -> run

for whatever reason the script seems to need a moment to start back up, in testing i had to give it a second or two before it properly kicked in.

also, thanks for the reloadable rocket launcher timing, i added it to the list of presets
EntropicMonk 23 Apr, 2015 @ 12:57am 
I'll play around with it a bit more, see what I can do. You should definitely make a video, you know better than anyone what it can really handle. Just want to offer whatever I can to make people aware of how awesome it is.

One request if you do a mode change... Might want to make it something that is present in large and small ship blocks, or easily editable in the script. I see some scripts use an interior light as a toggle.... but in vanilla, there IS no small ship interior light. =(
FoxBall  [author] 23 Apr, 2015 @ 12:29am 
@extropic monk, thats what i thought, it was a delay related thing. if you chain multiple timer blocks you can get very short delays (which should still be enough, you might need to experiment). i may consider toying with the script itself to make this transition simpler, perhaps reading whether or not a light is on, or other such togglable thing to make mode switches a feaure.

i'd gladly accept footage, though i will probably still make my own video to REALLY show what kind of nonsense you can do with it.
jarhead 22 Apr, 2015 @ 8:13am 
Tis issue your having is that your trying to turn the on as a group. You need to go in and turn them on 1 at a time to get them all on.
EntropicMonk 22 Apr, 2015 @ 12:13am 
After much testing, I think I may be stuck with what I've got, but it's no fault of your script. For the record, here's what I'm doing:

When switching rapid fire and simultaneous modes, I'm using the targeting lasers and terminal to see which guns are on. Switching the programmable block off and forcing the guns on causes one gun to stay off every time. I've seen this with a number of automated functions and believe it's an issue with the timer block.

I tried turning off the programmable block, the sequencer timer, and both while turning the guns on with and without a delay. The only reliable method was to delay the launchers being forced back on.

Even with a slight delay, the usefulness of the firing sequencer is in no way diminished for me. I'm going to put this on every damn thing I build that has guns. Maybe you should have a video that includes several people's creations to get some variety. I'd be glad to give you some footage when I've uploaded my ship, if you want.
FoxBall  [author] 21 Apr, 2015 @ 9:43pm 
@extropicMonk :D one can hope!

as for the mode switch, i believe i cobbled one together once, here's what needs to happen:
1. turn the program block off
2. enable all guns (probably as a group for convienience's sake)
3. wait for guns to reload if you've just fired (this may be where your problem is)

to switch back to rapid fire:
1. turn the program block on
2. run the program

you can probably get away with using two timer blocks for this, one to switch to simultanious, the other to switch back. you MIGHT need two to switch to simultanious mode (theres no gaurantee the program will have actually stopped at the right moment, which might inadvertently turn off one or more guns)

and yes the firing rate is porportional to the ammount of guns present :D that was a MUST for me

as far as publicity goes, my guess is the old rule of "no pics no clicks", i really ought to make a video of this in action
EntropicMonk 20 Apr, 2015 @ 10:33pm 
This thing is boss, dude. I honestly thought it'd change based on how many weapons were in the chain, but apparently you've got it figured out. I don't know why this isn't more popular.

I'm going to show it off as part of a small ship I've been crafting since FOREVER.. Hopefully you can get some more publicity from it, who knows.

There is one thing that did prove difficult, though I managaed to find a workaround. I'm using a toggle to switch between rapid firing the launchers one at a time, and all 6 simultaneously. At first doing so would cause one launcher to stay off. I used a timer delay to force them on, though it's a bit clunky. Do you have any suggestions to make it more idiot-proof?
FoxBall  [author] 20 Apr, 2015 @ 10:04pm 
@jarhead, hope you dont mind but i added your comment to the description
FoxBall  [author] 20 Apr, 2015 @ 10:00pm 
@extropicMonk that's pretty close to exactly what i have in mind! a cheeky way of making slow firing weapons into monsters >:D. the only way i've seen to make them fire in order is to place them in the order you want them to fire in. (i toyed around with the idea back when i made it) there's no 100% perfect way to get it to do it from what ive found. i blame the incredibly weak API. i might have to do more experimentation with this in the future
EntropicMonk 18 Apr, 2015 @ 11:40pm 
So this thing is pretty awesome. Not sure if what I'm using it for really fits what you had in mind, but I love it. Got 6 reloadable rocket launchers firing in sequence at .014, and this thing rocks!

Question: Is there a way to set the order the weapons fire in? I tried renaming in order and building in order, in case either of those were used. Apparently it's something else...?
jarhead 5 Apr, 2015 @ 3:18am 
For those that have problems with steam not loading scripts (seems to be a regular occurring issue). I would recommend going through your scripts that your subscribed to and after you have loaded each into your PB (programmable block). Reopen the script browser and save the script so it gets added to you local list in case you need a cop of it again when steam won't load the online scripts.
FoxBall  [author] 27 Mar, 2015 @ 1:20pm 
@blub9529 it makes each gun fire one at a time. which means that while one is firing, the rest are reloading and you can make a bunch of cannons behave like a gigantic machine gun.
blub9529 26 Mar, 2015 @ 4:48am 
sorry for some stupid questions, but what exactly does this script? i mean, for what do i use it? sorry for bad english, i'm not a native speaker :/
FoxBall  [author] 26 Feb, 2015 @ 8:20pm 
@haximodor92 thanks, ive updated the script to include your timing for the 25cm RaK.
haximodor 26 Feb, 2015 @ 6:52pm 
The 25 gun 's cycle time is about 0.0016f, between the 8.8Rak and LargeShip Railgun.
FoxBall  [author] 23 Feb, 2015 @ 9:59pm 
odd, havent loaded up the game in a while so i didnt see this, just assumed you couldnt get past SE's cumbersome at best interface
Baleur 23 Feb, 2015 @ 3:51pm 
It isnt, its a problem with the latest update it seems, some people on the forums have the same issue of newly subscribed scripts not appearing. Local scripts in the local folder appears though.
haximodor 22 Feb, 2015 @ 11:57pm 
I can't find the script either. Seems to be the problem of steam, all workshop script can't be loaded in game. The workshop browse is just blanket.
FoxBall  [author] 22 Feb, 2015 @ 4:29pm 
@baleur open up the script screen ("edit" button) in the program block, then press "browse workshop" it should be there