Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shutdown
#1
Haha Tongue The timer for the server shutdown is set to 5000ms, which equals to 5s.

Make it 2000, or it wont be correct with the actual text that is sent to all players online.

Or replace this:
[code]Static Secs As Long

If Secs
Reply
#2
It'd be better if you changed the interval to 1000 and...

[code]Static Secs As Long

If Secs
Reply
#3
Ill get my revenge when I have time in this topic Wink
Reply
#4
I just realized GSD did the same thing as I did, only he did it really badly and used a bunch of "if" statements.

Bad GSD! Bad!
Reply
#5
pingu Wrote:I just realized GSD did the same thing as I did, only he did it really badly and used a bunch of "if" statements.

Bad GSD! Bad!

You scammer, stealing code Wink
Reply
#6
William Wrote:
pingu Wrote:I just realized GSD did the same thing as I did, only he did it really badly and used a bunch of "if" statements.

Bad GSD! Bad!

You scammer, stealing code Wink

Eh, no...

It's like this in Elysium (that means GSD coded it):
[code]Static Secs As Long

If Secs
Reply
#7
Yep it is. Whats this in your other post:

[code]If Secs Mod 5 = 0 Or Secs
Reply
#8
Mod returns the remainder, so Secs Mod 5 means if it is a perfect interval of 5, such as 5, 10, 15, 20, etc.
Reply
#9
Spodi Wrote:Mod returns the remainder, so Secs Mod 5 means if it is a perfect interval of 5, such as 5, 10, 15, 20, etc.

Okay, I need to go to my math classes, cause you lost me at remainder. Although I from sweden, so don't judge me Wink
Reply
#10
It's simply the "%" operation in most other languages.

EDIT:

Saw your post.

9 / 5 = 2 with 4 left over.

"Mod" simply calculates what is left over. If 0 is left over, it's a perfect divide.
Reply
#11
pingu Wrote:It's simply the "%" operation in most other languages.
Okay, so that means Im stupid since I still dont understand it. WTG William! The "Secs" variable doesnt change, so why is there a need for Mod 5?
Reply
#12
William Wrote:
pingu Wrote:It's simply the "%" operation in most other languages.
Okay, so that means Im stupid since I still dont understand it. WTG William! The "Secs" variable doesnt change, so why is there a need for Mod 5?

Secs does change. Every second it is lowered by 1.
Reply
#13
Yes, but in that if statement.

Code:
If Secs =

Should not change by adding Mod 5.
Reply
#14
William Wrote:Yes, but in that if statement.

Code:
If Secs =

Should not change by adding Mod 5.

Secs is "Static", meaning it acts just like a global variable. You might not get that part.
Reply
#15
Now I understand Smile

PingusIQ = 100 Mod 5

Which means it is 20 Tongue

Well anyway, that should be correct, but this one yeah Wink

PingusDadsShoeSize = 2150 Mod 37.8

= 56,878306878306878306878306878307

= 55 ???? noo,, I dont think I understand now.. DAMMIT!

EDIT: I know what static is, dont insult me.. Im not retarded Tongue Just not the theory of Mod
Reply
#16
Verrigan Wrote:
William Wrote:PingusIQ = 100 Mod 5

Which means it is 20 Tongue

Actually, 100 Mod 5 = 0, since 100 / 5 = 20 with 0 as a remainder. (Mod just returns the remainder)

So if the outcome is a whole number, its always zero? And elseif its something else like 67, it would be 70 ? :oops:
Reply
#17
Verrigan Wrote:99 Mod 5 would be 4 (99 / 5 = 19 with 4 remaining)
98 Mod 5 would be 3
97 Mod 5 would be 2
96 Mod 5 would be 1
95 Mod 5 would be 0 (Because if it divides evenly with no remainder, the remainder is zero)

99 / 5 = 19,8 which means 0.8 remaing? Where do you get the 4 from?
Reply
#18
Look, I managed to think up a formula to help you.

If you do:
Num1 Mod Num2


It translates to:
Num1 - (Num2 * Int(Num1 / Num2))
Reply
#19
pingu Wrote:Look, I managed to think up a formula to help you.
If you do:
Num1 Mod Num2

It translates to:
Num1 - (Num2 * Int(Num1 / Num2))

That I understand. But isnt there something called: what you dont know doesn't hurt you.

And to translate that into a coding statement.

What you can't code correctly, program around it, if you can't program around it: dig a hole, lay down, and beg for someone to fill the hole.

Discussion Closed. I still don't understand fully, but I don't want to. Just so everybody know, Im a "A" student in Mathematics (studying on IB).
Reply
#20
Would you mind not flipping out on us? This isn't about your grade in math, it's about understanding a very useful operation that you will need for programming in any language.

Okay, I'll try once more to explain, but I'll try to jam everything into one post.

Don't get intimidated because this operator is text instead of a symbol. It doesn't make much sense because it isn't a function, but an operator. I'm going to use the "@" symbol instead of "Mod" (or "%", because that get's confused with percentage). Got it?

So, sample problem number 1 goes like this:
13 @ 5 = ?

Now, take it in steps. Find out what "13 / 5" equals. It's 2.6, but there is a nasty decimal at the end. We don't want him so we round down to 2. Now we need to multiply this 2 by the number we divided by. Normally, this would give you the same number you started with (13), but because we rounded down, it won't.

5 * 2 = 10

We now have 10. This is telling us that 10 is the highest number below 13 that can be divided by 5 evenly. Knowing that, we just compare 10 and 13.

13 - 10 = 3

3 is our answer. The remainder of a division problem is the difference between the closest perfect divide (that means that it doesn't have a decimal answer) and the number we started with.


I don't know how you learn, so I'm going to try it in terms of fractions.

67 @ 10 = ?

Let's divide using the calculator first.

67 / 10 = 6.7

In this method, we don't throw the decimal out yet. I've used "10" to make this much easier to do. Split the number according to the space right before the decimal.

So, we have:

6

And

.7

We need to figure out what .7 is in terms of something over 10 (If it were 67 @ 8, we'd figure it out over 8 instead. Yhis rule applies for all problems, not just 10 and 8!)

x / 10 = .7

Simple algebra here. Multiply both sides by 10 and you get:

x = 7

Guess what? The answer is 7. If we were in school and had to divide and find that remainder, 6 would be the answer (67 / 10 rounded down) and 7 would be the remainder (67 @ 10).


I hope I kind of help. It's easiest to use mod with 10, because it works perfectly.

85 @ 10 = 5
42 @ 10 = 2
70 @ 10 = 0

But, as I showed...

30 @ 5 = 0
29 @ 5 = 4
28 @ 5 = 3
27 @ 5 = 2
26 @ 5 = 1
25 @ 5 = 0

You'll get used to it. I do it in my head a slightly different way. I round up instead and then subtract the other way, but they both work.
Reply
#21
He's just trying to help you, William...

Especially if you're taking math, you should know how to do this. Remainders are something you deal with when you first learn division in elementary school. If you dont know it now, you are going to be screwed later on if you ever need to use it again.

And grades only show how much you study what is being taught at the time, not how good you are at the subject.
Reply
#22
hehe.. Just read the first posts and understood it now Tongue Not sure why I didn't get this before.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)