Wrong Return

09/11/2013 14:08 maches#1
Hello,

I just learning AutoIT. I'm trying write my function from Delphi to AutoIT

My Delphi code :

Quote:
i := 0;
cs_adr := func.MemReadInteger(LoginCharList);
p_selected := func.MemReadInteger(LoginSelectedChar);
p_point := cs_adr + (p_selected * LoginCharListDist);
address_end := func.MemReadInteger(LoginCharListEnd);
lastchar := ((address_end - cs_adr) div LoginCharListDist) - 1 ;

//read all characters
namesize := func.MemReadInteger(cs_adr + (i * LoginCharListDist ) + LoginCharListDistNameSize);
and I wrote it to auto IT like that..

Quote:
$i = 0
$cs_adr = MemoryReadInt($LoginCharList)
$p_selected = MemoryReadInt($LoginSelectedChar)
$p_point = $cs_adr + ($p_selected * $LoginCharListDist)
$address_end = MemoryReadInt($LoginCharListEnd)
$lastchar = ($address_end - $cs_adr) / Round($LoginCharListDist,1) -1

; read all characters
$namesize = MemoryReadInt($cs_adr + ($i * $LoginCharListDist) +
$LoginCharListDistNameSize)
and I have on delphi return 6 (correct) and on AutoIT 0, could anyone help me what I 'm doing wrong? ;/
09/11/2013 16:24 alpines#2
Just saying that div is not the same as Round, you should use:
Code:
Int(($address_end - $cs_adr) / $LoginCharListDist)
instead.