Originally Posted by
rishula
so when i run my script it opens the right click menu for player like it should but it doesn't find option Attack and it just exits the menu. im trying to make so my script clicks the attack option on opponent.
In the future, use SIMBA tags so your posted code is easier to read, like so:
Simba Code:
program new;
{$I AeroLib/AeroLib.simba}
procedure attack();
var
x,y :integer
begin
FindColoredArea(x, y,3161919 , 6, 8, 507, 326, 0);
MoveMouse(x, y);
wait(500);
ClickMouse(x, y, mouse_right);
wait(500);
if WaitOption('Attack', 5000) then
ChooseOption('Attack');
wait(500);
end;
function FindPlayer(): boolean;
var
x, y :integer;
begin
result := FindColoredArea(x, y,3161919 , 6, 8, 507, 326, 0);
end
begin
while (true) do
begin
if (FindPlayer()) then
begin
attack();
end;
end;
end.
In your code, you use waitOption, and then after that chooseOption, which is redundant, because chooseOption is already part of waitOption. Regarding the failure to click the option, try debugging getOptions() in a never-ending loop to see what it returns when right-clicking anywhere.
Simba Code:
//Debugging Code Example
repeat
writeln(getOptions());
wait(50);
until false;
Run that and test out what is printed to Simba's debug console when right clicking. Ensure OSRS is selected as Simba's target and feel free to post any screenshots of what is happening.