I see mod as a keyword in math functions and I was wondering what that was?
I see mod as a keyword in math functions and I was wondering what that was?
Formerly known as Cut em2 it



It's short for modulus. It's just like dividing, but it returns the remainder instead. For example, 5 mod 3 would be 2.
Yes like he said it just means the remainder of division. 5 mod 3 = 2 would be a correct statment.
People often use it like this:
SCAR Code:If(CurrentLoads Mod HowManyLoads = 0)Then
NextPlayer(TRUE/False);
Etc..
Code:
- Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
- Solarwind: Dude, you are like... t3h s3x.
- Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
- benjaa: woah.... Jukka is the man Guildminer pwns all
- NaumanAkhlaQ: And JuKKa Is my Her0!
The result of that is calculated this way:SCAR Code:NumberX mod NumberY
SCAR Code:NumberX-(NumberY*(NumberX/NumberY))
Very simply, even though it might look a little confusing.
-Knives
That formula can't be right, KoK. NumberY * (NumberX / NumberY) will always give you NumberX again. You'll always get 0 using that formula, so I assume something's wrong.
EDIT: My bad, I thought you were Timer for some reason.
:-)
Who are you calling "Timer" ?
Weirdly, my formula works correct. I understand how you can see a problem, but it gives the right answers to me. Maybe I need to test it a little more.
-Knives
basically broken down it takes first input divided by the second one and returns the remainder. Useful for doing things like every three timesSCAR Code:if i mod 3 = 0 then



Okay, that makes a lot more sense. I just figured it wasn't rounded, but I guess it is. Thanks for clearing that up.
:-)
There are currently 1 users browsing this thread. (0 members and 1 guests)