blockay
2013-02-26 21:15:27
I am having trouble making a variable = 0 only at the start of the script. can someone please tell me where i can declare it to do this?
2013-02-26 21:15:27
2013-02-26 21:17:55
program Test;
Var
Number:Integer;
procedure DoStuff;
begin
Writeln('stuff')
end;
begin
Number := 0
repeat
DoStuff;
Until False;
end.
2013-02-26 21:19:50
From: rjj95
Like this?program Test;
Var
Number:Integer;
procedure DoStuff;
begin
Writeln('stuff')
end;
begin
Number := 0
repeat
DoStuff;
Until False;
end.
2013-02-27 02:00:10
From: blockay
thats exactly where i put it and if all of my other coding was correct then it was declaring it as 0 randomly throughout the script
i'm pretty sure its not my code, i'm still having the problem, it doesn't declare it as 0 randomly, everytime the script restarts and goes through the main process it happens.
2013-02-27 02:14:08
2013-02-27 11:26:55
begin
run := 0;
if (run = 0) then
begin
MarkTime(i)
turnRunOn;
z := 1;
end;
end;
2013-02-27 11:57:27
From: blockay
this is what i have, it doesn't work properly
2013-02-27 13:19:25
begin
run := 0;
repeat
if (run = 0) then
begin
MarkTime(i)
turnRunOn;
z := 1;
end;
until (false)
end;i have it like this, i don't believe that run := 0; is in the loop this way. but i will try to not declare := 0; and report back if it works or not2013-02-27 13:31:58
2013-02-27 13:54:05
program CutterShafter;
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
var
x, aInteger, inventory, math, TreeColor3, k, y, i, z, run, logs, knife, TreeColor, TreeColors: integer;
procedure DTM;
begin
TreeColor := 4162679;
TreeColors := 2574918;
TreeColor3 := 2902849;
runIsOn := 1777019;
end;
Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
end;
Procedure CallThings;
Begin
{Going to Name the Bitmap string " Ring ", and declare the variable under Var}
knife:= BitmapFromString(10, 10, 'meJwztnE1tfMwBpIOnowMDCUlNY' +
'WFVVlZRX39M4FcoDgEAdllZXVA2dy88rS03HnzVkFkgbpMHdwgsvk' +
'FlRkZ+ZMmzQVyFRQMrJy8IWZWVDQAzczOKU1JyV68eD1EFq4RYiZQ' +
'47TpiyBSEFkgm9MqFIhmzlrW2TVl2fJNEFmIYyBScAVYNUIQr0cO3' +
'D1AhFUKUxZZCuxUEAIANwhKdQ==');
logs := BitmapFromString(7, 13, 'meJwL6F8f0L9eNqTcNq3VOqUJggL' +
'AgnBxiBRcBKLGKrEeiGTDq0AooAjCBSIttyizqDKgiEV8jZ5fGhwB' +
'BaW8s6U8MkwjiiDIODQfpBKsXcovH6gegoDKkB0AsQuoDFMQUyUQi' +
'TvHYwoyMjDABYEILgg3FqgSohgA9ylm1w==');
End;
Procedure FreeThings;
Begin
FreeBitMap(logs);
FreeBitMap(knife);
End;
procedure findTree;
Begin
if not (P07_FindObjCustom(x, y, [ree, tre], [TreeColor, TreeColor3, TreeColors], 1)) Then
case RandomRange(1,1000) of
1..250: P07_MakeCompassNorth;
251..500: P07_MakeCompassEast;
501..750: P07_MakeCompassSouth;
751..1000: P07_MakeCompassWest;
end;
End;
Function IsCutting: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(238, 149, 286, 186);
Result := (AveragePixelShift(PBox, 250, 350) > 350);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
End;
Function IsWcing: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(238, 149, 286, 186);
Result := (AveragePixelShift(PBox, 250, 350) > 150);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
End;
Function IsFletching: Boolean;
var
PBox: TBox;
Begin
PBox := IntToBox(250, 145, 273, 175);
Result := (AveragePixelShift(PBox, 250, 350) > 75);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
End;
procedure makeShafts;
Begin
MarkTime(thaTime);
If FindBitMapToleranceIn(logs, x, y, MIX1, MIY1, MIX2, MIY2, 50) Then
Mouse(x, y, Random(3), Random(3), true);
P07_ChooseOptionMulti(['weiner']);
P07_MakeCompassNorth;
If FindBitMapToleranceIn(knife, x, y, MIX1, MIY1, MIX2, MIY2, 50) Then
Mouse(x, y, Random(3), Random(3), true);
P07_ChooseOptionMulti(['use']);
P07_MouseBox(24, 435, 130, 452, 3);
Wait(RandomRange(400,500));
ClickMouse2(Mouse_Right);
Wait(RandomRange(300,400));
P07_ChooseOptionMulti(['ake X', 'X']);
Wait(RandomRange(750,900));
SendKeys('88', 95, 35);
Wait(RandomRange(300, 400));
P07_UseKey(13);
Wait(RandomRange(3000, 5000));
If IsFletching then
begin
inventory := P07_InvCount;
repeat
repeat
if TimeFromMark(thaTime) > 50000 then Break;
Wait(500);
until (inventory < P07_InvCount);
until (P07_InvCount < 4);
end
else
if (P07_InvCount > 4) then
begin
inventory := P07_InvCount;
repeat
repeat
if TimeFromMark(thaTime) > 50000 then Break;
Wait(500);
until (inventory < P07_InvCount);
until (P07_InvCount < 4);
end;
end;
Procedure turnRunOn;
begin
if i > (math) then
begin
P07_MouseBox(665, 470, 686, 493, 3);
Wait(RandomRange(400,500));
ClickMouse2(Mouse_Left);
If (Not FindColorTolerance(x,y,runIsOn,625,413,658,447, 4)) Then
begin
P07_Mousebox(625, 413, 658, 447, 3);
Wait(RandomRange(200, 350));
ClickMouse2(Mouse_Left);
Wait(RandomRange(200, 350));
P07_TabInventoryTab(4);
z := (z + 1);
end
else
If FindColorTolerance(x,y,runIsOn,625,413,658,447, 4) Then
begin
P07_TabInventoryTab(4);
z := (z + 1);
end;
end;
end;
procedure ChopTree;
begin
If not IsWcing then
If P07_FindObjCustom(x, y, ['Tree', 'own Tr'], [TreeColor, TreeColor3, TreeColors], 1) Then
if Random(28) = 1 then
begin
ClickMouse2(mouse_right);
P07_ChooseOptionMulti(['Chop']);
Wait(RandomRange(500, 1000));
end
else
begin
ClickMouse2(mouse_left);
P07_ChooseOptionMulti(['Chop']);
Wait(RandomRange(550, 1000));
end
else
If not (P07_FindObjCustom(x, y, ['ree', 'tre'], [TreeColor, TreeColor3, TreeColors], 1)) Then
case random(1000) of
1..250: P07_MakeCompassNorth;
251..500: P07_MakeCompassEast;
501..750: P07_MakeCompassSouth;
751..1000: P07_MakeCompassWest;
end;
end;
procedure waiting;
begin
MarkTime(thaTime);
aInteger := P07_InvCount
if IsCutting then
repeat
if TimeFromMark(thaTime) > 12000 then Break;
Wait(500);
Until (P07_InvCount > aInteger)
end;
begin
run := 0;
DTM;
CallThings;
P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
P07_MakeCompassNorth;
Addonterminate('FreeThings')
Wait(1000);
repeat
math := (100000 * z);
If (Not P07_LoggedIn) Then
begin
P07_LogInPlayer;
P07_MakeCameraAngleHigh;
end;
if (run = 0) then
begin
MarkTime(i)
turnRunOn;
z := 1;
end;
if(P07_InvFull) then
repeat
k := 1;
IsFletching;
makeShafts;
until (P07_InvCount < 4)
else
if not (P07_InvFull) then
begin
repeat
findTree;
ChopTree;
waiting;
until (P07_InvFull)
end;
Until (false)
FreeThings;
End;
2013-02-27 13:54:11
run:=1; inside either your "turnRunOn" procedure or inside: if (run = 0) then
begin
MarkTime(i)
turnRunOn;
z := 1;
end;
2013-02-27 13:58:21
From: nivek1989
(responding publicly after a pm of his script)
You never set the variable to 1. You will need to setinside either your "turnRunOn" procedure or inside:run:=1;if (run = 0) then
begin
MarkTime(i)
turnRunOn;
z := 1;
end;
2013-02-27 14:18:48
From: blockay
wow i feel so stupid. thanks
i am trying to do too much at once i guess, i'll be sure this never happens again lol
works great now :) well i did learn that if you don't declare a variable it begins at zero, that is good to know
2013-02-27 14:35:47
From: nivek1989
No worries! Also, booleans start as false all the time (if you happen to use those in the future).
2013-02-27 14:40:03
2013-02-27 14:42:50