Using loops Log Out | Topics | Search
Moderators | Edit Profile

X-Ways Support Forum » Advanced Features » Using loops « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Brian wyles (Brianwyles)
Posted on Wednesday, Aug 28, 2002 - 20:56:   

Hi Stefan
I am having trouble getting the following loop to work.It keeps looping for the total No of loops figure is met.I am assuming that my problem is that I am trying to compare a hexadecimal value(variable) with a decimal one (count). Is there any way in which I can do this?
Here is the section of script.

read variable 2
assign count 1
{
move "x"
ifequal count variable exitloop
else inc count
}[500]

Thanks

Brian
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Thursday, Aug 29, 2002 - 0:24:   

First of all, an EndIf statement is missing, and I don't know what "x" is. The main difficulty, however, seems to be that "IfEqual" to compare so strictly, and at the binary level:

"variable" consists of 16 bits. "count" initially consists of 8 bits (smallest integer type that can represent the number 1). If a 16-bit variable is compared to a 8-bit variable at the binary level, the result is always false (cf. documentation). Only if "variable" represents an integer number that is larger than 255, the comparison can return {true} when "count" has been extended to 16 bits to overcome the 8-bit integer barrier.

Possible solution: insert the following two statements before "assign count 1" in order to make "count" initially a 16-bit variable, too:

Move -2
Read count 2

Add Your Message Here
Post:
Username: Posting Information:
Only registered users may post messages here, i.e. you need to have an account.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:
Forum operated by X-Ways Software Technology AG.