Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Math and triggers
Math and triggers
Oct 26 2008, 5:13 am
By: Morphling  

Oct 26 2008, 5:13 am Morphling Post #1



How can I simplify a fraction via triggers. I have DC1 as my denominator and DC2 as my numerator.



None.

Oct 26 2008, 1:03 pm y10k Post #2



This should work
how it works:

You have, A/B

You decrease B to 0 with a binary countdown, simultaneously decreasing it from A too.
You need to store B's value to a C one during the countoff. You might need to store your original numerator as well (A->D).
With this you can count, how many times (E) this can be executed (till A reaches 0).
You restore C's value to B and start again.

S2 is set, S1 is cleared, DC1 & DC2 >= 32 => DC1 & DC2 : -32 , DC3 & DC4 : +32
S2 is set, S1 is cleared, DC1 & DC2 >= 16 => DC1 & DC2 : -16 , DC3 & DC4 : +16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
but in decreasing order.
S2 is set, S1 is cleared, DC2 = 0 => DC5++ , set S1
S2 is set, S1 is set, DC3 >= 32 => DC2 : +32 , DC3 : -32
S2 is set, S1 is set, DC3 >= 16 => DC2 : +16 , DC3 : -16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
S2 is set, S1 is set, DC3 = 0 => clear S1.
S2 is set, S1 is cleared, DC1 = 0, DC2 >= 0 => clear S2

S2 is cleared : DC5 = quotient, DC4 = original numerator, DC2 = should stay whatever it is.

S1 is set when you count the denominator and check if it is lower than the numerator, if yes you increase quotient by 1 and reset denominator (S1 is cleared)
S2 is cleared when operation has finished. Set S2 to start the operation.
Required amount of trigger cycles is the quotient (these must be run as many times as that is)

17123 / 3 will take a long time, while 400/31 takes only 13 cycles.



None.

Oct 26 2008, 2:13 pm Falkoner Post #3



You could also increase the speed by having conditions that if they have, say 300, then you add 100 to the quotient, and subract 300, and that can speed it up so it can be done in a single trigger loop.

Of course, the best method would be to use Binary Count-Offs instead, check out this tutorial on how to use them for division.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:42 am]
RIVE -- Hellooooo, Nurse
[04:19 pm]
NudeRaider -- Hello World!
[2026-6-01. : 4:03 pm]
IskatuMesk -- no Hello World? No Hello . jpeg? Not even ddosing some government website? smh my head
[2026-5-31. : 10:02 pm]
Symmetry -- I was really just figuring out how to compile
[2026-5-31. : 10:02 pm]
Symmetry -- I didn't make it do anything
[2026-5-31. : 9:17 pm]
Ultraviolet -- hell yeah. did you have trouble making the button functional, or just haven't gotten there yet?
[2026-5-31. : 8:29 pm]
Symmetry -- I made the marine shoot lasers and gave the medic a nonfunctional button
[2026-5-31. : 8:07 pm]
Ultraviolet -- Symmetry
Symmetry shouted: I did my first EUD thing today. Feels like me finding arsenal at age 8 again
haha for sure. in some ways it's even more exciting because you can play EUD maps on regular battle.net, don't need to convince someone to download your mod to play with you. what did you do?
[2026-5-31. : 6:47 pm]
Symmetry -- I did my first EUD thing today. Feels like me finding arsenal at age 8 again
[2026-5-31. : 3:20 pm]
l)ark_ssj9kevin -- le reddit
Please log in to shout.


Members Online: NudeRaider