PDA

View Full Version : Script wont find TMSObject



bl3d3
04-21-2020, 06:40 PM
Hi, I've been trying to make a simple script on one of the pservers, but it wouldn't click on object. I made couple scripts on other pserver and was using TMSObjects functions to find and click on the object i need. Everything would work fine, finds an object, checks if the uptext is correct and then would click it. Now when I've tried to make a similar script on other server, using same functions. It finds the color, moves the mouse to the object, but would not click it and keeps on looking for the object, because the uptext didnt match I guess? I made a procedure to check if it can find a tree, but it does not.



program new;
{$i AeroLib/AeroLib.Simba}

var
YewTree: TMSObject;

Procedure FindTree;
var
pnt:tpoint;
begin
if (not YewTree.Find(10, MSCP, pnt)) then
wait(500);
writeln('cannot find tree');
exit;
if YewTree.Find(10, MSCP, pnt) then
writeln('tree found');
FastClick(mouse_left);

end;

begin
initAL;
YewTree.create('Yew', ['down Yew', 'Chop down Yew'], [createCol(5542796, 15, 0.20, 1.40)]);
FindTree;
end;


I checked the uptext color and its the same as other pserver. I checked client size on both servers when selecting client and when I try to select it, it selects the whole client with the whole top bar. So maybe thats why it cannot find the uptext?
28693

chief herb
04-28-2020, 09:08 AM
Hi, I've been trying to make a simple script on one of the pservers, but it wouldn't click on object. I made couple scripts on other pserver and was using TMSObjects functions to find and click on the object i need. Everything would work fine, finds an object, checks if the uptext is correct and then would click it. Now when I've tried to make a similar script on other server, using same functions. It finds the color, moves the mouse to the object, but would not click it and keeps on looking for the object, because the uptext didnt match I guess? I made a procedure to check if it can find a tree, but it does not.



program new;
{$i AeroLib/AeroLib.Simba}

var
YewTree: TMSObject;

Procedure FindTree;
var
pnt:tpoint;
begin
if (not YewTree.Find(10, MSCP, pnt)) then
wait(500);
writeln('cannot find tree');
exit;
if YewTree.Find(10, MSCP, pnt) then
writeln('tree found');
FastClick(mouse_left);

end;

begin
initAL;
YewTree.create('Yew', ['down Yew', 'Chop down Yew'], [createCol(5542796, 15, 0.20, 1.40)]);
FindTree;
end;


I checked the uptext color and its the same as other pserver. I checked client size on both servers when selecting client and when I try to select it, it selects the whole client with the whole top bar. So maybe thats why it cannot find the uptext?
28693

not 100% sure but try to select client without the top bar and also some rsps have different fonts in the uptext. im not fond of the tms object really but not sure if the code above is correct? i use simple simple simple things in my rsps scripts and 9/10 i can accomplish what im going for with a simple thing like this with a bit of tweaking i would try to get something easy working first then move onto more complicated things. this is just a very basic example of something ive used to do many many things even if there were better ways. the way i did it worked for me. and part of learning is starting somewhere and trying to improve


procedure ClickNPC; //clicks an npc or etc
var
x, y : integer;

begin
if FindColorTolerance(x, y, 1234567, x1, y1, x2, y2, tolerance) then //npc color
begin
writeLn('found npc');
MoveMouse(x, y);
writeLn('moved mouse to npc');
wait (100 + Random(100));
ClickMouse(x, y, MOUSE_LEFT);
wait (100 + Random(100));
writeLn('clicked npc');
end
end; ps i dont take credit for this procedure