How can I write this logic?
3absh
Member Posts: 601
Constrain Self.Color.red of actor to tableCellValue(Table1, something, 1)
In Something what I need is to attach this value to:
Every 10 days row=row+1 until day 100 is reach
@day 101 the count starts over again and row = 1
I know it has something to do with ceil & Mod but I can't seem to figure it out.
Comments
Ceil(daycount/10)
will certainly give me a counter every 10 days to attach the row to, but I need a loop to start again @day 101
This is what I did, I hope it works (fingers crossed)
Just test it with a substitute attribute to replace your scene attribute and modify it with the keyboard input.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
It didn't work, problem with a Module loop is that it restarts at zero.
Mod(1,5)=1
Mod(2,5)=2
Mod(3,5)=3
Mod(4,5)=4
Mod(5,5)=0 (row in table starts at 1 not zero)
So this is not working
Can you have a rule that resets the counter when ten days pass?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Exactly, I'm thinking of wrapping the code inside a loop but I haven't figured it out yet. (actually the rest should occur at day 101)
This should work:
mod(floor(Day/10),10)+1
Mod(0,5)+1 =1
Mod(1,5)+1 =2
Mod(2,5)+1 =3
Mod(3,5)+1 =4
Mod(4,5)+1 =5
. . . . or, if the first value in the mod calculation is an attribute (let's call it X) and [i]needs[/i] to be 1,2,3,4 and 5 then . . .
Mod(X-1,5)+1
It WORKED!!!
@Manto Thank you and to all those who helped
@Socks
Yes your method is the same as @manto 's
excellent