I can bind only a few amount of units by repeating bind and set variable a few times, so when a unit control code is needed to run it will just bind to the unit in variable. the other processors might still conflict but uhhh whatever i could do the same or whatever
Thanks to this tutorial I made a turret feeder. Thank you so much. The turret feeder is on my channel by the way not promoting just for those who may want the schematic
This is a highly useful method, semaphore, used wildly in any os to avoid the fetch of stale data or to have two writers modify the same file at once. It is used in real life and yes!! Also in your current device.
My only complaint is that there's no write lock. For the uninformed, a write lock would prevent two processors from reading an empty flag and trying to write a new flag simultaneously, which could lead to a single flag value, but multiple controlling processors. However, that's only really a problem because the two processors are trying to spam bind units. My typical work around to stay at a separate processor handle requests from the two originals.
Honestly, I don't see that as a problem as, typically, the processors would check for the flag number a second time and skip or bind that particular unit based on its number. It might cause some hiccups in the unit for a few seconds, but it should be fine in the long run.
basically: the proccesor went "thats my unit >:(" and put a mark on the unit telling the other processors that its his sounds an awful lot like a slave mark to me
I tried the tutorial even though it was released last year. It is not working for me sadly. So I'm trying to figure out what's the problem since thisx and thisy keeps on sending the units bottom left corner of the map.
For anyone coming here to learn... this is a great tutorial that explains how most people do the job, and, it explains well. The following is a discussion point for advanced logic users only. :) Firstly, i love that bit of music hehehe Secondly... Flagging isnt as necesary as people think that it is. I have several campaign bases which run a variety of unit based processors. And, they all run without conflicts, and, no flags. This leaves me capable of using the flagging system for higher level control, such as allowing processors to request a taxi for units which are not capable of flying, and to encode the target location into the flag. I even have some systems which are set up to display collective information about all of the units, as i figured out also how to bind a unit and read it's sensor data without ever confusing it's registered controller variable, allowing access to that data without disturbing the unit's job. I used it to create two displays, one which shows how many units of each type exist, and, how many are idle, and a second one which displays a sort of behavioural heatmap, showing every unit as a new dot and the dot's colour is defined by the activity. Then, it fades the display.
Oh, also, i should mention that for any unit controller which doesnt try to take control of every unit of a type then it's naturally compatible with my code. All the processor needs to do to "acquire" sole control to a unit is give it an order. It still doesnt conflict if the units are all taken, but, it does then fail to find free units of that type... So, my code naturally avoids conflicts with almost all other code. And not a single flag present to wave. If the other processors do use flags, it still doesnt conflict.
Another bonus to my non flagging system is that they dont actually require any code edits to make them work independently of each other, no need to allocate flags manually.
@@ElectricGun100 i am trying to make a program that has a single mega move titanium from one container to another. How do I make the processor flag a single mega?
Noob question: Isn't it possible to replicate the same effect of: jump 2 equal fl 0 (Checks if the unit's flag is 0, flags the unit if it is, continues to the next if else statement if it isn't ) jump 3 notEqual fl flag (Checks if the unit's flag is the flag set by this script, ends the command if it isn't, flags the unit again if it is, somehow) ucontrol flag flag 0 0 0 0 end Just with: jump 2 notEqual fl 0 (Checks if the unit's flag is not 0, ends the command if it isn't, flags the unit if it is) ucontrol flag flag 0 0 0 0 end ? I did some testing here and it seems to work just fine for less commands.
@@ElectricGun100 I know. I was asking if jump _ notEqual fl 0 is able to replicate the effect of "jump _ Equal fl 0" and "jump _ notEqual fl flag", since it prevents already flagged units from being flagged with this script's flag (ends the command if the unit's flag isn't 0, meaning that it doesn't flag any unit whose flag isn't 0), and allows flag-free units to be flagged (else, flags the unit with this script's flag, meaning that that it only flags units whose flag is 0). Maybe there's something more complex about it I didn't understand, but Idk.
If there is 2 processors with flare logic, first one will reserve all the flares settig flag by his own. How can i use one flare to each processor, including flare death case?
Give each processor a unique flag and use a boolean that becomes 1 if a free flare is bound and flagged. Leave boolean as 0 if bound flare is already flagged
Nvm. I found a way not very compact but possible. I use another processor with same full code i used but with different untit to bind because multiple bind commands dont go. So use only one bind that works
You cannot have more than one different unit binds during one CYCLE. TL;DR, you can bind different units on a single processor but it won't be efficient.
Now I can bind to specific flares and not steal every single flare on the map
All processors must have a flag rule
I can bind only a few amount of units by repeating bind and set variable a few times, so when a unit control code is needed to run it will just bind to the unit in variable. the other processors might still conflict but uhhh whatever i could do the same or whatever
I despise Mindustry logic. I'm used to programming using Ifs and loops and having to use jumps quickly turns any program into a hard to follow mess.
Same
I occasionally do assembly programming so I'm used to only having jumps, but a lot of programming in mindustry feels like being back in the early 90s.
I think it's meant to be kinda unwieldy so that you stay within the game and don't go into full programmer mode
@@ElectricGun100 Even worse if you aren't a programmer like me just trying to get Meta glass from kilns to the core with 2 micro processors...
Thanks to this tutorial I made a turret feeder. Thank you so much. The turret feeder is on my channel by the way not promoting just for those who may want the schematic
This is a highly useful method, semaphore, used wildly in any os to avoid the fetch of stale data or to have two writers modify the same file at once. It is used in real life and yes!! Also in your current device.
Nice
In theory you could use units to transfer info over long distances
That's literally a thing ever since logic came out
How do you transfer info in units?
Store the info in the flag?
@@LoerisOtter basically
We finally know what the magic numbers mean now
My only complaint is that there's no write lock. For the uninformed, a write lock would prevent two processors from reading an empty flag and trying to write a new flag simultaneously, which could lead to a single flag value, but multiple controlling processors. However, that's only really a problem because the two processors are trying to spam bind units. My typical work around to stay at a separate processor handle requests from the two originals.
Honestly, I don't see that as a problem as, typically, the processors would check for the flag number a second time and skip or bind that particular unit based on its number. It might cause some hiccups in the unit for a few seconds, but it should be fine in the long run.
It doesn't work when you change the flag value they still stick to processor 4:00
basically:
the proccesor went "thats my unit >:(" and put a mark on the unit telling the other processors that its his
sounds an awful lot like a slave mark to me
Welcome to Mindustry
thats nice and all but you didn't explain one thing
how can I bind a certain amount on each processor ?
Counter arrays
how do I check how many units are bound, for example I want 2 processors to control 2 flares each, and only 2 flares each and leave the rest idle.
I tried the tutorial even though it was released last year. It is not working for me sadly. So I'm trying to figure out what's the problem since thisx and thisy keeps on sending the units bottom left corner of the map.
I know it's been two months, but @thisx and @thisy
This is the answer why my flare delivery working bad
For anyone coming here to learn... this is a great tutorial that explains how most people do the job, and, it explains well. The following is a discussion point for advanced logic users only. :)
Firstly, i love that bit of music hehehe
Secondly... Flagging isnt as necesary as people think that it is. I have several campaign bases which run a variety of unit based processors. And, they all run without conflicts, and, no flags. This leaves me capable of using the flagging system for higher level control, such as allowing processors to request a taxi for units which are not capable of flying, and to encode the target location into the flag. I even have some systems which are set up to display collective information about all of the units, as i figured out also how to bind a unit and read it's sensor data without ever confusing it's registered controller variable, allowing access to that data without disturbing the unit's job. I used it to create two displays, one which shows how many units of each type exist, and, how many are idle, and a second one which displays a sort of behavioural heatmap, showing every unit as a new dot and the dot's colour is defined by the activity. Then, it fades the display.
Oh, also, i should mention that for any unit controller which doesnt try to take control of every unit of a type then it's naturally compatible with my code. All the processor needs to do to "acquire" sole control to a unit is give it an order. It still doesnt conflict if the units are all taken, but, it does then fail to find free units of that type... So, my code naturally avoids conflicts with almost all other code. And not a single flag present to wave. If the other processors do use flags, it still doesnt conflict.
Another bonus to my non flagging system is that they dont actually require any code edits to make them work independently of each other, no need to allocate flags manually.
Very nice video but only 480p (it was hard to see the text)
This is a game changer
I use flags on most of my unit logic
It stops working after i bind 2 flares :c
bro u r a time saver 🛐 also subbed 👁️👄👁️
This, Is Legendary, 10/10
great tutorial
Ok
Ok
Breaks the chain, even tho there’s no any chain
Thanks♥♥♥
How do i flag only one unit
Counters n stuff
Wait nvm i just haven't watched the previous video
@@ElectricGun100 i am trying to make a program that has a single mega move titanium from one container to another. How do I make the processor flag a single mega?
@@Jay-iq4rp if @unit not null, stop binding
The video is too fast i cant catch up shit
i don’t want to be mean but its confusing
I know right
@@ElectricGun100 especially to a vietnamese guy like me, i can barely understand :(
Noob question:
Isn't it possible to replicate the same effect of:
jump 2 equal fl 0
(Checks if the unit's flag is 0, flags the unit if it is, continues to the next if else statement if it isn't )
jump 3 notEqual fl flag
(Checks if the unit's flag is the flag set by this script, ends the command if it isn't, flags the unit again if it is, somehow)
ucontrol flag flag 0 0 0 0
end
Just with:
jump 2 notEqual fl 0
(Checks if the unit's flag is not 0, ends the command if it isn't, flags the unit if it is)
ucontrol flag flag 0 0 0 0
end
?
I did some testing here and it seems to work just fine for less commands.
The second jump exists to avoid flagging already flagged units
@@ElectricGun100 I know. I was asking if jump _ notEqual fl 0 is able to replicate the effect of "jump _ Equal fl 0" and "jump _ notEqual fl flag", since it prevents already flagged units from being flagged with this script's flag (ends the command if the unit's flag isn't 0, meaning that it doesn't flag any unit whose flag isn't 0), and allows flag-free units to be flagged (else, flags the unit with this script's flag, meaning that that it only flags units whose flag is 0). Maybe there's something more complex about it I didn't understand, but Idk.
Ok
Ok
Ok
Ok
Ok
Ok
If there is 2 processors with flare logic, first one will reserve all the flares settig flag by his own.
How can i use one flare to each processor, including flare death case?
Give each processor a unique flag and use a boolean that becomes 1 if a free flare is bound and flagged. Leave boolean as 0 if bound flare is already flagged
@@ElectricGun100 Nice, but how can i be sure, that flare is dead?
@unit doesnt become null when unit dead.
@@VladisS.Vostok2000 @dead
How to bind multiple unit types? Like flate and horizon? Thankyou
Nvm. I found a way not very compact but possible. I use another processor with same full code i used but with different untit to bind because multiple bind commands dont go. So use only one bind that works
You can use an array of unit binds on one processor then loop your entire code x number of times
You cannot have more than one different unit binds during one CYCLE.
TL;DR, you can bind different units on a single processor but it won't be efficient.
what is logic schem code
Instruction unclear my small brain still didn't understand
how do i put different flags on each individual mono, in order for them to do different tasks?
Have you figured it out? I've been searching and searching and searching, but i still have no clue
@@pavlepetrovic989 i did
@@pavlepetrovic989 actually nvm i dont
@@shtwick XD
@@shtwick did you just stop playing mindustry?
not working