PDA

View Full Version : My script wont work. Please help.



SeaHorseShooter
06-20-2014, 11:32 PM
Hello all! I'm coding a simple script to take the grapes from the cooking guild, and then later I will be learning on how to take the grapes and store them in the bank etc but my code does not seem to be working. It finds the grape just fine, but it does not right click like it is supposed to. Here is my code

program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

procedure clickGrape();
var
x, y: integer; //we need to declare these variables since findObject outputs these
begin
if mainscreen.findObject(x, y, 6822793, 54, ['grape'], MOUSE_RIGHT) then
begin
writeLn('We right clicked a grape'); //if findObject results true, this will print
chooseOption.select(['Take Grapes']); // this will choose ‘Take Grapes’ option in chooseOptions menu
end;
end;

begin
clearDebug();
setupSRL();
clickGrape();
end.

Any help on why it is not right clicking the grape and then picking it up? All help appreciated! :D

Ian
06-20-2014, 11:38 PM
So it says 'We right clicked a grape' but doesn't move the mouse to the grape or click it?

SeaHorseShooter
06-20-2014, 11:42 PM
if mainscreen.findObject(x, y, 6822793, 54, ['grape'], MOUSE_RIGHT) then
That brings the mouse to the grape, but for some reason it does not right click. And it does not even say 'We right clicked a grape' I get nothing.

Ian
06-21-2014, 12:01 AM
if mainscreen.findObject(x, y, 6822793, 54, ['grape'], MOUSE_RIGHT) then
That brings the mouse to the grape, but for some reason it does not right click. And it does not even say 'We right clicked a grape' I get nothing.

You need to capitalize 'grape' to 'Grape' strings are case sensitive.

SeaHorseShooter
06-21-2014, 12:04 AM
Thank you! It's working now :) Thanks a lot.

Lucidity
06-21-2014, 06:15 PM
Hey,

I have the same problem too, but it isn't detecting the objects. I've tried on a door and a portal, neither worked. Here's my code for the door.

EDIT: Works, thanks!

I'm unsure if my code is wrong, but I used ACA on CTS 1 for the Color and Tolerance.

Thanks, trying to learn so I can release some work into the community once I get a hang of it.

Cheers,
xevo1