SRL Archive - OSR Help

Help with an error


coolblue42

2014-02-24 02:40:24

So no one replies to errors on hoodz cooking script thread… Could you guys tell me what these errors mean and how to fix them?

[Hint] C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba(685:3): Variable 'TP' never used at line 684
[Error] C:\Simba\Includes\SRL-OSR\SRL\core\antirandoms\C_AntiRandoms.simba(3:3): Duplicate identifier 'DTM_Royal_Frog' at line 3
Compiling failed.

riwu

2014-02-24 05:42:41

The first one is just a hint, if you want to fix it just remove the unused variable mentioned.
The second one means there's more than one declaration of the same variable name, same solution as above.

villa

2014-03-02 10:27:52

did the solution work coolblue42? coz i have this error and i cant see any duplicate declarations

Sk1nyNerd

2014-03-02 11:36:22

From: villa
did the solution work coolblue42? coz i have this error and i cant see any duplicate declarations


in simba hit ctrl+f and type what it says the duplicate word is that the error is saying. if there isnt one does a second window in simba open up that highlights the error?

villa

2014-03-02 14:04:58

it opens c_anitrandoms.simba

which is this

Var
DTM_Royal_Frog,EC_ScreenText: Integer;

Procedure FreeCRGlobals;
begin
FreeDTM(DTM_Royal_Frog);
FreeBitmap(EC_ScreenText);
end;

(*
DoConversationEx
~~~~~~~~~~~~~~

.. code-block:: pascal

function DoConversationEx(resultText: TStringArray; clickresult: boolean): boolean;

Goes through the initial dialog of a random. Will keep clicking to continue
until any of the conversation's 'resultText' is found. Will click to continue when
any 'resultText' is found if 'clickresult' is set to true. Set 'resultText' to ['']
to click continue until conversation is over.

.. note::

Author: Coh3n, Flight
Last Modified: Jun. 15th, 2013 by Flight

Example:

.. code-block:: pascal

if (DoConversationEx(['thank','nk you'], true)) then
writeln('Finished conversation');
*)
function DoConversationEx(resultText: TStringArray): boolean;
var
t,i: integer;
begin
while (t < 25) do // max of 25 "click to continue's"
begin
if (length(resultText) > 0) then
for i:=0 to high(resultText) do
if (findNPCChatText(resultText[i], nothing)) then
begin
result := true;
exit;
end;

// break if there's no more conversation
if (not clickContinue(true)) then
break;

wait(100 + random(200));
inc(t);
end;
end;


(**
* Author: Flight
* Description: Handles solving the random event.
*)
function Frog_Solve2: Boolean;
var
cRan: Boolean;
t,i,F,X,Y: Integer;
responses: TStringArray;
label
Start;
begin
Start:
cRan := false;
responses := ['lrigh','Okay','kay.','I supp','pose so','yeah','Yeah','Sure','ure'];
for i:=1 to 5 do
if FindDTM(DTM_Royal_Frog, X, Y, MSx1, MSy1, MSx2, MSy2) then
begin
MMouse(X, Y, 0, 0);
if WaitUpTextMulti(['Frog','to Fr'], 300) then
begin
Writeln('Frog_Solve2: Found royal frog');
ClickMouse2(mouse_right);
Wait(randomRange(100,250));
cRan := waitOptionMulti(['Talk-to Frog','to Fr','Frog'], 500);
if cRan then
break
else
MouseBox(MCx1, MCy1, MCx2, MCy2, mouse_move);
end;
end;

if not cRan then
begin
Writeln('Frog_Solve2: Failed to locate the royal frog, exiting');
Exit;
end;

Writeln('Frog_Solve2: Talking to royal frog...');

if not waitFunc(@areTalking, 10, 6000) then
begin
Inc(F);
if (F > 4) then
begin
Writeln('Frog_Solve2: Failed to talk to the royal frog, exiting');
Exit;
end;
GoTo Start;
end;

MarkTime(t)
repeat
if DoConversationEx(responses) then
begin
Writeln('Frog_Solve2: Reached response');
for i:=0 to High(responses) do
if findTextTPA(0, 5, MCx1, MCy1, MCx2, MCy2, responses[i], CharsNPC07, ClickLeft) then
begin
Writeln('Frog_Solve2: Chose correct option');
ClickToContinue;
break;
end;
end;
until(timeFromMark(t) > 15000)

MarkTime(t)
repeat
if ClickContinueEx(True, True) then
break;
until(timeFromMark(t) > 10000)

Result := True;
Writeln('Frog_Solve2: Successfully solved the Frog random!');
end;

{*******************************************************************************
function FindTalk_F: Boolean;
by: Ashaman88 & Flight
Description: Searches screen for NickName and handles ALL Talking Randoms
*******************************************************************************}

function FindTalk_F: Boolean;
var
ax,ay,yCount,zCount,Count2,x1,y1,x2,y2,
X,Y,Count1,bmpScreen: Integer;
RawMenuText: String;
rTalkStrings: TStringArray;
begin
Result := False;
if (GetArrayLength(Players) < 1) then Exit;

if FindColor(ax, ay, 65535, MSX1, MSY1, MSX2, MSY2) then
begin

SetArrayLength(gtalksBox, 0);
SetArrayLength(YelSkipBoxs, 0);

y1 := ay;
if ( ( ay + 5 ) > 334 ) then y2 := 334 else y2 := ay + 5;

x1 := ax; x2 := x1;
zCount := 0;

repeat
if FindColor(ax, ay, 65535, x2, y1 + 2, x2 + 3, y2 + 3) then
zCount := 0
else
zCount := zCount + 1;

if ( zCount = 4 ) then Break;
x2 := x2 + 3;
until ( x2 + 3 > 515 );

if ( x2 + 3 <= 515 ) then x2 := x2 - 12;

if (x2 - x1 >= length(Players[CurrentPlayer].Nick) * 4) then
begin

x1 := x1 - 8;
y1 := y1 - 8;
x2 := x2 + 8;
y2 := y2 + 8;

if ( x1 < 0 ) then x1 := 0;
if ( y1 < 0 ) then y1 := 0;
if ( x2 > 515 ) then x2 := 515;
if ( y2 > 334 ) then y2 := 334;

Count2 := Count2 + 1;
Count1 := Count1 + 1;
SetArrayLength(gtalksBox, Count2);
gtalksBox[Count2 - 1].x1 := x1;
gtalksBox[Count2 - 1].y1 := y1;
gtalksBox[Count2 - 1].x2 := x2;
gtalksBox[Count2 - 1].y2 := y2 + 6;

SetArrayLength(YelSkipBoxs, Count1);
YelSkipBoxs[Count1 - 1].x1 := x1;
YelSkipBoxs[Count1 - 1].y1 := y1;
YelSkipBoxs[Count1 - 1].x2 := x2;
YelSkipBoxs[Count1 - 1].y2 := y2;

end else
begin
y1 := y1 - 2;
y2 := y2 + 8;
x1 := x1 - 5;
x2 := x2 + 5;
if ( x1 < 0 ) then x1 := 0;
if ( y1 < 0 ) then y1 := 0;
if ( x2 > 515 ) then x2 := 515;
if ( y2 > 334 ) then y2 := 334;

Count1 := Count1 + 1;
SetArrayLength(YelSkipBoxs, Count1);
YelSkipBoxs[Count1 - 1].x1 := x1;
YelSkipBoxs[Count1 - 1].y1 := y1;
YelSkipBoxs[Count1 - 1].x2 := x2;
YelSkipBoxs[Count1 - 1].y2 := y2;
end;

if ( GetArrayLength(gtalksBox) <> 0 ) then
begin
for yCount := 0 to GetArrayLength(gtalksBox) - 1 do
begin
if FindBitmapMaskTolerance(NickNameBMP, ax, ay, gtalksBox[yCount].x1, gtalksBox[yCount].y1, gtalksBox[yCount].x2, gtalksBox[yCount].y2, 0, 40) then
begin
WriteLn('Found NickName');
ax := (gtalksBox[yCount].x2 + gtalksBox[yCount].x1) shr 1;
ay := gtalksBox[yCount].y2 - 2;

if gTalkSaveBitmap then
begin
bmpScreen := BitmapFromString(515, 334, '');
CopyClientToBitmap(bmpScreen, 1, 1, 515, 334);

if ( gtalksBox[yCount].x1 = 0 ) then x1 := 1 else x1 := gtalksBox[yCount].x1;
if ( gtalksBox[yCount].y1 = 0 ) then y1 := 1 else y1 := gtalksBox[yCount].y1;

gTalksCount := gTalksCount + 1;
for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);

if ( gtalksBox[yCount].x2 = 515 ) then x1 := 515 else x1 := gtalksBox[yCount].x2;
if ( gtalksBox[yCount].y2 = 334 ) then y1 := 334 else y1 := gtalksBox[yCount].y2;

for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + x1, Count2 + y1, 255);

for Count1 := -1 to 1 do
for Count2 := -1 to 1 do
FastSetPixel(bmpScreen, Count1 + ax, Count2 + ay, 255);
SaveBitmap(bmpScreen, ScriptPath + 'FTalk' + IntToStr(gTalksCount) + '.bmp');
FreeBitmap(bmpScreen);
end;

if not FindDTM(DTM_Royal_Frog, X, Y, MSx1, MSy1, MSx2, MSy2) then
begin
MMouse(ax, ay, 0, 0);
Wait(100 + Random(50));
if WaitUpTextMulti(['Talk','lk-to','uard','ard','security','ecurity','curity'], RandomRange(150,300)) then
begin
Mouse(ax, ay, 0, 0, mouse_Right);
Wait(150 + Random(100));

rTalkStrings := ['o Sec','o San','o Gen','o Mil','o Gil','o Nil','o Ric',
'o Dru','o Cap','o Mys','o Dr'];
if (ChooseOptiongetMenuText(RawMenuText, rTalkStrings, ClickLeft)) then
begin
WriteLn('******** FOUND TALKING RANDOM TEXT********: ' + RawMenuText);
Flag;
Wait(700 + Random(300))
if SolveTalkingRandom(RawMenuText) then
Result := True;
Exit;
end;
end;
end else
begin
WriteLn('******** SOLVING FROG RANDOM ********');
if Frog_Solve2 then
Result := True;
Exit;
end;
end;
end;
end;
end;
end;

function foundEvilChicken: Boolean;
var
x,y: Integer;
begin
Result := False;
if FindColor(x, y, 65535, MSX1, MSY1, MSX2, MSY2) then
if FindBitmapMaskTolerance(EC_ScreenText, x, y, MSX1, MSY1, MSX2, MSY2, 0, 40) then
Result := FindBitmapMaskTolerance(NickNameBMP, x, y, MSX1, MSY1, MSX2, MSY2, 0, 40);
end;

Procedure SetupCustomRandoms;
begin
DTM_Royal_Frog := DTMFromString('mbQAAAHicY2VgYLgDxLeB+CYQ34OyeRgZGDgZIbQAEPMD8cpOYYbfZ1QZDs4RYziuKcbw+5wxgxxQLTpmxoLBAAB7VQzf');
EC_ScreenText := BitmapFromText('lee', 'UpChars07');
AddOnTerminate('FreeCRGlobals');
Writeln('Custom Anti-Randoms setup');
end;

Function FindCustomRandoms: Boolean;
var
i: integer;
tmpTS: LongInt;
manually: boolean;
tmpH,tmpS,tmpMod: Extended;
begin
tmpTS := GetToleranceSpeed;
GetToleranceSpeed2Modifiers(tmpH,tmpS);
tmpMod := GetToleranceSpeed3Modifier();
// no tabs exists if bank is open; could throw false positives
if (not loggedIn()) or (bankScreen()) then
exit;

if (not SRL_RandomsSet) then
_SetRandoms();

if SRL_CombatRandoms then
if (foundEvilChicken or SRL_infight) then
begin
runaway(RandomDirection, False, 1, RandomRange(2000,4000));
result := true;
exit;
end;

if FindTalk_F then
begin
result := true;
exit;
end;

for i := 0 to high(SRL_Randoms) do
begin
_resetColorMods( tmpTS,tmpH,tmpS,tmpMod);

if (_SolveRandom(i, manually)) then
begin
// if the random was solved by hand, break out of the loop
if (manually) then
begin
result := true;
break;
end;

// solve reward box if a non inventory random was just solved
if (loggedIn()) then // if solver failed, player would be logged out
if (not SRL_Randoms[i].isInvRandom) then
begin
// reward box doesn't exist if inventory is full/some randoms don't have reward box
result := (invFull() or (not SRL_Randoms[i].hasRewardBox));

if (not result) then
begin
if (waitFunc(@_Callback_SolveRandom, 50, 5000)) then
_SolveRandom(SRL_RAND_REWARDS, manually); // check if we chose another reward
end;
end;

result := true;
end;

// don't want to keep looking for randoms if one was already detected, but failed
if ((result) or (not loggedIn())) then
break;
end;

findDead();
findMod();

if SRL_HasProc(SRL_OnRandomCall) then
SRL_Procs[SRL_OnRandomCall]();
_resetColorMods( tmpTS,tmpH,tmpS,tmpMod);
end;

the error is:

[Error] C:\Simba\Includes\SRL-OSR\SRL\core\antirandoms\C_AntiRandoms.simba(3:3): Duplicate identifier 'DTM_Royal_Frog' at line 3
Compiling failed.

there is nothing on line 3 either

get this with all the scripts i try as well

Sk1nyNerd

2014-03-02 14:11:42

try commenting that anti random out. put (* at the start of it and *) and the end of it. If you are calling FindNormalRandoms along with flights antirandom solver that is why you are getting that error. they both have DTM_Royal_Frog declared in them. idk how flights anti random solver is but you probably only to call one of the two in your script to solve the randoms

villa

2014-03-02 14:21:26

will try, i appreciate the help very much thank you

turpakeikka

2014-09-27 06:40:11

Hi im very new user of simba and Im asking where do I need to actually put the "" put (* at the start of it and *) "". :)

riwu

2014-09-27 08:04:45

From: turpakeikka
Hi im very new user of simba and Im asking where do I need to actually put the "" put (* at the start of it and *) "". :)

Just delete 'DTM_Royal_Frog,' will have the same effect as commenting out.
Though it's not likely that the include is broken so did u update ur include? srl>check for update.