• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Maths problem

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
hi everyone,

i would like to store a 6 digit number and then get one of the value:

ex: 132540
with maths i need to be able to retrieve the value of any digit
ex
value 2nd digit = 3
value 4th digit = 5

is there an equation using Jass that can do this?
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
thanks Mr_bean

actually i just allready found the answer
modulo operation ( % )

153406 % 10 = 6
(153406 - 6) / 10 = 15340
15340 % 10 = 0
(15340 - 0) / 10 = 1534
1534 % 10 = 4
(1534 - 4) / 10 = 153
153 % 10 = 3
(153 - 3) / 10 = 15
15 % 10 = 5
(15 - 5) / 10 = 1
1 % 10 = 1

i just need to store the modulo into reverse order
set integer[6] = 153406 % 10 = 6
set integer[5] = 15340 % 10 = 0
etc...
 
Status
Not open for further replies.
Top