Jump to content

Weird Problem Apparently 2 Does Not Equal 2


 Share

Recommended Posts

OK, straight to the problem we go.

EXAMPLE CODE

For $i = 1 to 10 Step 1

$TOTPRICE = Round(($TOTPRICE + $PRICE),2)

$ASK = ($TOTPRICE * $DISCOUNT)

$ASK = $ASK - $CREDIT

$ASK = Round(($ASK),2)

$TAKE = Ceiling($ASK)

Next

; SO if I MsgBox $TAKE I get "2"

Next

I do the following

$READ = PixelChecksum(128, 586, 196, 618)

$VALUE = IniRead("d:\Lookup.ini", "LookUp", $READ, 0)

If I MsgBox $VALUE I get "2"

Then my CODE says

If $TAKE <> $VALUE then ExitLoop

My problem is the ExitLoop is always firing even though $TAKE = $VALUE

Now I even tried inserting the following

$NEW1 = Number($TAKE)

$NEW2 = Number($VALUE)

If I MsgBox $NEW1 & ":" $NEW2 I get "2:2"

So 2 is definately = 2

However when I use the 2 values in the code

Like

If $NEW1 = $NEW2 then MsgBox(0,"msg","test") the messagebox does not get fired even though 2=2.

I am really amazed at whats going on here.

Is it some conversion problem? Because I am getting the Second value using an IniRead?

Help would be greatly appreciated

Thanks

Supe

Link to comment
Share on other sites

CODE
SelectTickets()

$ABC = PixelChecksum(128, 586, 196, 618) ;CurrentSelected Tickets

$GHI = IniRead("d:\Tickets.ini", "Tickets", $ABC, 0) ;GHI = CurrentSelected Ticket Number

If $TAKE <> $GHI then ExitLoop

;MsgBox(0,"msg", "debug2")

WaitFinalConfirm1()

CODE

For $i = 1 to $BUYAMOUNT Step 1

$TOTPRICE = Round(($TOTPRICE + $PRICE),2)

$Y = $Y + 12

Next

$ASK = ($TOTPRICE * $DISCOUNT)

$ASK = $ASK - $CREDIT

$ASK = Round(($ASK),2)

$TAKE = Ceiling($ASK)

In Both Cases when I MsgBox $TAKE and $GHI the Answer is the same, however the ExitLoop is always triggered.

I cant Paste my whole code of my program here, for 2 reasons, 1 its over 1500 lines, and secondly its kinda top secret stuff :P

Dont see how this will help.

My only question really was if IniRead somehow forces the Value to be captured as a "String" and the $TAKE was a number, then a String "2" and number 2 would not be equal???

But I did use Number($TAKE) and Number($GHI) with the same result, so Im a little confused

Thanks

Edited by superboss
Link to comment
Share on other sites

DOnt Worry, I figured it out.

The problem was the rounding and/or Ceiling function

$TAKE must have been equal to something like 1.899898 etc etc

Using Int($TAKE) worked, although that also does not make sense.

as Int($TAKE) should yield 1 and not 2

Whatever, its working now so I guess its ok, weird though.

So if I say

If $TAKE = 2 then Msgbox "blah blah" this DOES NOT GET FIRED

but

If Int($TAKE) = 2 does get fired. And trust me the real value is not 2.12321342 etc.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...