疤痕浮动或双重至Int [英] Scar Divi Float or Double to Int

查看:150
本文介绍了疤痕浮动或双重至Int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

疤痕浮动或双重到Int。我如何将浮点数/双精度值传递给整数?



这是代码。我正在尝试找到位图并点击中心,问题是当我尝试划分x或y来找到img中心。

 程序FindBitmap; 

label
main;

var
Bmp:TSCARBitmap;
x,y:整数;
temp1,temp2:String;

begin
ClearDebug;
骨形态发生蛋白:= TSCARBitmap.Create( 'deNqtzGkKglAUhuE2Ea2pwXm8atpAFCIVRdEKi' +
'qJCkBBpAeVQa + zCBRGH ++ cEz6 / Dd95Oq92ajoZwE8eCG9sm3GhowDkWgrNNHc4' +
'yNDgTqbnz6fjNMrr49XIXs + IXZuhK0fVyphSS99tz56UXDGlyEb7491ttIY3jp' +
'eeW9oSuSCVIlQPfLxWyJFkvveqY0GSxCnceQZAXPmm6Xa9ql4QqCbVwJwpDEtl' +
'vN00zQhb5JkhTnlF02O8oG0ISOApFEugDQuRZOIFj4Hh2AMcxfTh20PuDfhfuB'+
'32bFT0 =');
main:
如果FindBitmap(x,y,bmp,0,0,2559,1023)然后
begin
WriteLn('IMG FOUND!');
ClickMouse((x + Bmp.Width / 2),(y + Bmp.Height / 2),mbLeft);
end
else
begin
goto main
end;

结束。

ClickMouse不起作用,Scar Divi说:类型不匹配

解决方案

Sertac Akyuz 有解决方案:更改/为div返回一个整数。

  ClickMouse (x + Bmp.Width div 2),(y + Bmp.Height div 2),mbLeft); 

问题是我不能有小数坐标。


Scar Divi Float or Double to Int. How I pass a Float/Double to Integer?

Here's the code. I'm trying to Find the bitmap and click on the center, the problem is when I try to divide the x or y to find the img center.

program FindBitmap;

label
main;

var
Bmp: TSCARBitmap;
x, y: Integer;
temp1, temp2: String;

begin
 ClearDebug;
 Bmp := TSCARBitmap.Create('deNqtzGkKglAUhuE2Ea2pwXm8atpAFCIVRdEKi' +
    'qJCkBBpAeVQa+zCBRGH++cEz6/Dd95Oq92ajoZwE8eCG9sm3GhowDkWgrNNHc4' +
    'yNDgTqbnz6fjNMrr49XIXs+IXZuhK0fVyphSS99tz56UXDGlyEb7491ttIY3jp' +
    'eeW9oSuSCVIlQPfLxWyJFkvveqY0GSxCnceQZAXPmm6Xa9ql4QqCbVwJwpDEtl' +
    'vN00zQhb5JkhTnlF02O8oG0ISOApFEugDQuRZOIFj4Hh2AMcxfTh20PuDfhfuB' +
    '32bFT0=');
main:        
if FindBitmap (x, y, Bmp, 0, 0, 2559, 1023) then
begin
WriteLn('IMG FOUND!');    
ClickMouse((x + Bmp.Width / 2),(y + Bmp.Height / 2),mbLeft);
end
else
begin
goto main
end;

end.

ClickMouse doesn't work, Scar Divi says: Type mismatch

解决方案

Ok, tanks to all. Sertac Akyuz had the solution: change the / for a div to return an integer.

ClickMouse((x + Bmp.Width div 2),(y + Bmp.Height div 2),mbLeft);

The problem was that I can't have a decimal coordinate.

这篇关于疤痕浮动或双重至Int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆