Jump to content

Recommended Posts

Firstly, you can do this instead.

$var1 *= $var2

Secondly, what does $var1 start as?

$var1 = 2
$var2 = 1
$var1 *= $var2
msgbox(0,0,$var1)

This works fine for me.

*Edit: And what w0uter meant was did you divide by zero? (I guess he should have said #/0, # being any number) Anything divided by zero will give you the result you're getting. (Ooops, see correction#2)

*Correction: Upon testing, I notice that anything divided by zero returns "1.#INF"

I find -1.#IND in the helpfile under ACos, ASin, Log, and Mod.

Are you using any of these functions in your script?

*Correction#2: Er, uh.. nevermind, w0uter is right. 0/0 (zero divided by zero) will return -1.#IND. Anything ELSE divided by zero will return 1.#INF. My bad.

Edited by Saunders
Link to post
Share on other sites

Also: Did you try my example? Does it work?

*Edit: What w0uter said, but you don't need to give us a 2 page script either. Just post a working example that gives you the error. And by working I mean one that you can copy and paste, add nothing to, and run and it will give you the same error. That way we can test the exact same thing.

Edited by Saunders
Link to post
Share on other sites

Division by zero:

$armorAm = GUICtrlRead($ArmorAmount) ; assume this is 0

...

$AttackR = $armorAm * 0.06 ; 0 * .06 = 0

$AttackR2 = 1 + (0.06 * $armorAm) ; 1 + .06 * 0 = 1

$AttackR = $AttackR / $AttackR2 ; $attackR = 0 / 1 = 0

$AttackAvg2 = $AttackR ; AttackAvg2 = 0

$AttackAvg2 = Round($AttackAvg2, 2) ; $AttackAvg2 = 0 (rounded)

$AttackAvg2 = $AttackAvg2 * 100 ; $AttackAvg2 = 0 * 100 = 0

$AttackAvg2 = $AttackAvg / $AttackAvg2 * 10

; $AttackAvg2 = $AttackAvg / 0 * 10 = ($AttackAvg / 0) * 10 !ERROR!

Since someone can (probably) have 0 armor points (if they're walking around naked, and aren't very hairy, I suppose), you will probably need to do an alternate calculation for that instance.

Edited by Jason_A
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...