Mindustry

Mindustry

Tidak cukup rating
Unit Counter
   
Penghargaan
Favorit
Difavoritkan
Batalkan favorit
Tag: schematic
Ukuran File
Diposting
678.000 B
28 Des 2020 @ 12:00am
1 Catatan Perubahan ( lihat )

Berlangganan untuk mengunduh
Unit Counter

Deskripsi
Counts how many of each unit type you have.

Inspired by u/pavlic148's design on Reddit.

Schematic code:
bXNjaAF4nAGWAmn9AAMAAgIABG5hbWUADFVuaXQgQ291bnRlcgALZGVzY3JpcHRpb24AAAMAD2xvZ2ljLXByb2Nlc3NvcgAHbWVzc2FnZQALbWVtb3J5LWNlbGwAAAADAAAAAAAOAAACJnicjZTLbtswEEWVAgVafwXhL7AaJ0Z26SNFN32lQRdFNzRFy2woUuHDjvP1HVI0mhbBZaGFJPJoZsihzknTvDReBqbYYpbuptw3yvlAz3ZkQ9QsDCMhr9Ir7zp2KWw0Qbo8fjaLa2VosON9L93sV6TB8yXjes8Pni0oSgEGLiSY3lgXnPQeIF7IMcAcTqregHljdxxMj1F7juLfRY6BndQogbBuF9ESheN7DZfIg+P3aJNG5awIKIK7PagOAMHe2xESG80daubWOvVgUScepFFhi6o0IQ5rh3ZTCq1Gj+oYrLGo31Yf0NeyR+npMKA9wk1wyntU2qDMLVrZ2h06NO+lQrUN8bizqwWTtBLNLiN1hJmo9ZMT2QlHBRi62hL/gvVOcvovb7Z8Gv+jkPzpxJ0+LmPvVJDECql1y0qlq2VJSK65OGZSdJVM7eMIR239h6JWq0x7NmfvsqTmJd7p+b8RE/ORPIWJ90VVmPo22QpD10lYGPlEzsLEl6wtzHzN5sLMd5IXJt5mf1WYSWEYep0sVtm/SWSVONllmLmZdFbpaTIaRj5MUsPQj+y1StFFbZi6muxWOawkuMrhIMdVYpDmqoensn2fa426Tr6r1JGUh5E3yXqVYyNVpdTkvvmMnNUx8beB2mVbFCTog9EpE9j8J3V8ehTl7p+Q0+qMaVJCcuDV3WSwDG909Fs20BTvZTtrmuZZ8zwnpYeT5sVxht6a38cm7yAAAQACAAAEAQAAAAIAAgABAACqFS9c

Logic
Manipulates @counter to set the jump target programmatically, to keep the code short(er).
set i 0 set n 0 set first 0 op mul tmp i 2 op add @counter tmp 5 ubind @dagger jump 64 always 0 0 ubind @mace jump 64 always 0 0 ubind @fortress jump 64 always 0 0 ubind @scepter jump 64 always 0 0 ubind @reign jump 64 always 0 0 ubind @nova jump 64 always 0 0 ubind @pulsar jump 64 always 0 0 ubind @quasar jump 64 always 0 0 ubind @vela jump 64 always 0 0 ubind @corvus jump 64 always 0 0 ubind @crawler jump 64 always 0 0 ubind @atrax jump 64 always 0 0 ubind @spiroct jump 64 always 0 0 ubind @arkyid jump 64 always 0 0 ubind @toxopid jump 64 always 0 0 ubind @flare jump 64 always 0 0 ubind @horizon jump 64 always 0 0 ubind @zenith jump 64 always 0 0 ubind @antumbra jump 64 always 0 0 ubind @eclipse jump 64 always 0 0 ubind @mono jump 64 always 0 0 ubind @poly jump 64 always 0 0 ubind @mega jump 64 always 0 0 ubind @quad jump 64 always 0 0 ubind @oct jump 64 always 0 0 ubind @risso jump 64 always 0 0 ubind @minke jump 64 always 0 0 ubind @bryde jump 64 always 0 0 ubind @sei jump 64 always 0 0 ubind @omura jump 70 equal @unit null jump 70 equal @unit first op add n n 1 jump 69 greaterThan n 1 set first @unit jump 3 always 0 0 write n cell1 i jump 74 equal i 29 op add i i 1 jump 1 always 0 0 set i 0 op mul tmp i 2 op add @counter tmp 77 set s " Dagger" jump 136 always 0 0 set s " Mace" jump 136 always 0 0 set s " Fortress" jump 136 always 0 0 set s " Scepter" jump 136 always 0 0 set s " Reign" jump 136 always 0 0 set s " Nova" jump 136 always 0 0 set s " Pulsar" jump 136 always 0 0 set s " Quasar" jump 136 always 0 0 set s " Vela" jump 136 always 0 0 set s " Corvus" jump 136 always 0 0 set s " Crawler" jump 136 always 0 0 set s " Atrax" jump 136 always 0 0 set s " Spiroct" jump 136 always 0 0 set s " Arkyid" jump 136 always 0 0 set s " Toxopid" jump 136 always 0 0 set s " Flare" jump 136 always 0 0 set s " Horizon" jump 136 always 0 0 set s " Zenith" jump 136 always 0 0 set s " Antumbra" jump 136 always 0 0 set s " Eclipse" jump 136 always 0 0 set s " Mono" jump 136 always 0 0 set s " Poly" jump 136 always 0 0 set s " Mega" jump 136 always 0 0 set s " Quad" jump 136 always 0 0 set s " Oct" jump 136 always 0 0 set s " Risso" jump 136 always 0 0 set s " Minke" jump 136 always 0 0 set s " Bryde" jump 136 always 0 0 set s " Sei" jump 136 always 0 0 set s " Omura" read c cell1 i jump 141 equal c 0 print "\n" print c print s op add i i 1 jump 75 lessThanEq i 29 printflush message1

Micro processor unit counter
Cheaper, slower unit counter for use in absence of thorium.
bXNjaAF4nAGWAmn9AAMAAQIABG5hbWUADFVuaXQgQ291bnRlcgALZGVzY3JpcHRpb24AAAMAD21pY3JvLXByb2Nlc3NvcgALbWVtb3J5LWNlbGwAB21lc3NhZ2UAAAADAAAAAAAOAAACJnicjZTLbtswEEWVAgVafwXhL7AaJ0Z26SNFN32lQRdFNzRFy2woUuHDjvP1HVI0mhbBZaGFJPJoZsihzknTvDReBqbYYpbuptw3yvlAz3ZkQ9QsDCMhr9Ir7zp2KWw0Qbo8fjaLa2VosON9L93sV6TB8yXjes8Pni0oSgEGLiSY3lgXnPQeIF7IMcAcTqregHljdxxMj1F7juLfRY6BndQogbBuF9ESheN7DZfIg+P3aJNG5awIKIK7PagOAMHe2xESG80daubWOvVgUScepFFhi6o0IQ5rh3ZTCq1Gj+oYrLGo31Yf0NeyR+npMKA9wk1wyntU2qDMLVrZ2h06NO+lQrUN8bizqwWTtBLNLiN1hJmo9ZMT2QlHBRi62hL/gvVOcvovb7Z8Gv+jkPzpxJ0+LmPvVJDECql1y0qlq2VJSK65OGZSdJVM7eMIR239h6JWq0x7NmfvsqTmJd7p+b8RE/ORPIWJ90VVmPo22QpD10lYGPlEzsLEl6wtzHzN5sLMd5IXJt5mf1WYSWEYep0sVtm/SWSVONllmLmZdFbpaTIaRj5MUsPQj+y1StFFbZi6muxWOawkuMrhIMdVYpDmqoensn2fa426Tr6r1JGUh5E3yXqVYyNVpdTkvvmMnNUx8beB2mVbFCTog9EpE9j8J3V8ehTl7p+Q0+qMaVJCcuDV3WSwDG909Fs20BTvZTtrmuZZ8zwnbU7o5cVxhoab38cG7x4AAQABAAAAAAIAAgAABAEAAAC2yS7P
14 Komentar
facosa_rap 30 Jan 2022 @ 9:16am 
Quite useful for largy army management, know i know what kind of mecha needs more replacement units without having to count them or something.

Thanks
tom++ 21 Apr 2021 @ 10:53am 
Thank you very much for your help!
I didn't know that one could save a reference with set first @unit... .
This is unknown to many industry logic programmers because they often call ubind @... 50 or 100 times to be sure that they have bound each unit at least once..
killall -q  [pembuat] 19 Apr 2021 @ 12:27pm 
By temporarily storing the reference to the first bound unit, then checking if the reference to the currently bound unit matches.
tom++ 19 Apr 2021 @ 11:18am 
Thank you very much for your answer!,

But how can you tell that you have the first unit of this type again?
As far as I know, the @unit object has no unique ID.
killall -q  [pembuat] 18 Apr 2021 @ 2:04pm 
Each time ubind is called, it iterates to the next unit of that type in order. The logic loops until it re-encounters the first unit of that type, then goes to the next unit type.
tom++ 18 Apr 2021 @ 12:21pm 
What is the trick in this code? It works great, but it is magic... :-)

When you bind a unit with ubind, you can't distinguish it from another unit of the same type, can you?

Thanks a lot, kind regards,
Thomas
lammaer 7 Mar 2021 @ 1:03pm 
Useful stuff, wish it could be added to the HUD :D
Micmac87 28 Feb 2021 @ 2:17pm 
looks like a bug...
Micmac87 28 Feb 2021 @ 1:50pm 
i found the origin of the problem : it work as soon as i dont use "set" comand
Micmac87 28 Feb 2021 @ 9:35am 
if you can take a look to see what's wrong