• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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