SRL Archive - OSR Help

Need Passing Variables help


bud_wis_er_420

2012-01-05 03:01:57

the below script should pass the herb_text and Herb_dtm variables on to the next function or procedure, but it's not. What am I doing wrong? I have a few things commented out for testing while. It compiles but fails to pass the variables. i have a for loop in the beginning of the Get_Herb_Info procedure, to show that the variable is loaded. it eveything was working poperly it should print this:

Clean g
ean guam
an guam
Guam
Clean g
ean guam
an guam




////////////////////Ignore This Part////////////////////////
program New; //
//{$DEFINE SMART} //
{$i srl/srl.scar} //
var x,y,next :integer;



//
const //
////////////////////////////////////////////////////////////
Select_Task = 1; // 0 = Clean berbs. 1 = Make potions
Tolerance = 15;
AreaSize = 0;
AreaShape = 0;
////////////////////////////////////////////////////////////
///////////////////Begining of Script///////////////////////
////////////////////////////////////////////////////////////


function SetHerbDTM(Hcolor, Gcolor: integer): integer;
var
Sub_Pt: array[0..5] of TDTMPointDef;
Main_Pt: TDTMPointDef;
Herb_TDTM: TDTM;
begin
Main_Pt.x:=184;
Main_Pt.y:=103;
Main_Pt.areasize:=1;
Main_Pt.areashape:=0;
Main_Pt.color:=Hcolor;
Main_Pt.tolerance:=10;

Sub_Pt[0].x:=192;
Sub_Pt[0].y:=109;
Sub_Pt[0].areasize:=AreaSize;
Sub_Pt[0].areashape:=AreaShape;
Sub_Pt[0].color:=Gcolor; //This color is green or brown for clean or grimy
Sub_Pt[0].tolerance:=Tolerance;

Sub_Pt[1].x:=198;
Sub_Pt[1].y:=106;
Sub_Pt[1].areasize:=AreaSize;
Sub_Pt[1].areashape:=AreaShape;
Sub_Pt[1].color:=131072 ;
Sub_Pt[1].tolerance:=Tolerance;

Sub_Pt[2].x:=189;
Sub_Pt[2].y:=115;
Sub_Pt[2].areasize:=AreaSize;
Sub_Pt[2].areashape:=AreaShape;
Sub_Pt[2].color:=131072 ;
Sub_Pt[2].tolerance:=Tolerance;

Sub_Pt[3].x:=183;
Sub_Pt[3].y:=113;
Sub_Pt[3].areasize:=AreaSize;
Sub_Pt[3].areashape:=AreaShape;
Sub_Pt[3].color:=131072 ;
Sub_Pt[3].tolerance:=Tolerance;

Sub_Pt[4].x:=175;
Sub_Pt[4].y:=109;
Sub_Pt[4].areasize:=AreaSize;
Sub_Pt[4].areashape:=AreaShape;
Sub_Pt[4].color:=131072 ;
Sub_Pt[4].tolerance:=Tolerance;

Sub_Pt[5].x:=172;
Sub_Pt[5].y:=104;
Sub_Pt[5].areasize:=AreaSize;
Sub_Pt[5].areashape:=AreaShape;
Sub_Pt[5].color:=131072 ;
Sub_Pt[5].tolerance:=Tolerance;

Herb_TDTM.MainPoint := Main_Pt;
Herb_TDTM.SubPoints := Sub_Pt;
Result := AddDTM(Herb_TDTM);
end;


procedure Get_Herb_Info(herb:string; Herb_Text: TStringArray; Herb_DTM: integer);

begin
case herb of
'Guam' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
for next:=0 to high(Herb_Text) do
writeln(Herb_Text[next])
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Marrentill' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Tarromin' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Harralander': begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Ranarr' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Toadflax' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'SpiritWeed' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Irit' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Wergali' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Avantoe' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Kwuarm' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Snapdragon' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Cadantine' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Lantadyme' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'DwarfWeed' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Torstol' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Fellstalk' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
end;
end;


{function Store_Item(item: string,
begin

end; }


function Find_Item(x, y: integer; item: string): Boolean;
var
rightcount, downcount, Slotx, Sloty, DTM: integer;
text: TStringArray;
begin
Slotx := 31;
Sloty := 85;
rightcount := 0;
downcount := 0;
Get_Herb_Info(item, text, DTM);
repeat
repeat
if(FindDTM(DTM, x, y, Slotx, Sloty, Slotx + 44, Sloty + 44))then
begin
MMouse(x - 5, y - 5, 10, 10);
end;
Slotx := Slotx + 44;
rightcount := rightcount + 1;
until(IsUpTextMultiCustom([text]))or(rightcount >= 9)
Sloty := Sloty + 44;
Slotx := 31;
downcount := downcount + 1;
until(IsUpTextMultiCustom([text]))or(downcount >= 3)
if(IsUpTextMultiCustom([text]))then Result:= true;
end;

procedure Get_Item(item: string);
var
DTM,i: integer;
text: TStringArray;
begin
//if(Find_Item(x,y,item))then
//begin
//Store_Item(x,y,item)
//Mouse(x, y, 0, 0, false);
//end else writeln('Could not find ' + item);
Get_Herb_Info(item, text, DTM);
writeln(item)
for i:=0 to high(text) do
writeln(text[i])
end;


begin
ClearDebug();
//Smart_Server := 44;
SetupSRL();

//Withdraw_Herbs('Guam');
Get_Item('Guam')


end.

ShawnjohnSJ

2012-01-05 03:05:44

What are you setting 'DTM' to in procedure Get_Item?

Edit: Seems I totally skipped a line, my mistake.

Sex

2012-01-05 03:07:01

////////////////////Ignore This Part////////////////////////
program New; //
//{$DEFINE SMART} //
{$i srl/srl.scar} //
var x,y,next :integer;



//
const //
////////////////////////////////////////////////////////////
Select_Task = 1; // 0 = Clean berbs. 1 = Make potions
Tolerance = 15;
AreaSize = 0;
AreaShape = 0;
////////////////////////////////////////////////////////////
///////////////////Begining of Script///////////////////////
////////////////////////////////////////////////////////////


function SetHerbDTM(Hcolor, Gcolor: integer): integer;
var
Sub_Pt: array[0..5] of TDTMPointDef;
Main_Pt: TDTMPointDef;
Herb_TDTM: TDTM;
begin
Main_Pt.x:=184;
Main_Pt.y:=103;
Main_Pt.areasize:=1;
Main_Pt.areashape:=0;
Main_Pt.color:=Hcolor;
Main_Pt.tolerance:=10;

Sub_Pt[0].x:=192;
Sub_Pt[0].y:=109;
Sub_Pt[0].areasize:=AreaSize;
Sub_Pt[0].areashape:=AreaShape;
Sub_Pt[0].color:=Gcolor; //This color is green or brown for clean or grimy
Sub_Pt[0].tolerance:=Tolerance;

Sub_Pt[1].x:=198;
Sub_Pt[1].y:=106;
Sub_Pt[1].areasize:=AreaSize;
Sub_Pt[1].areashape:=AreaShape;
Sub_Pt[1].color:=131072 ;
Sub_Pt[1].tolerance:=Tolerance;

Sub_Pt[2].x:=189;
Sub_Pt[2].y:=115;
Sub_Pt[2].areasize:=AreaSize;
Sub_Pt[2].areashape:=AreaShape;
Sub_Pt[2].color:=131072 ;
Sub_Pt[2].tolerance:=Tolerance;

Sub_Pt[3].x:=183;
Sub_Pt[3].y:=113;
Sub_Pt[3].areasize:=AreaSize;
Sub_Pt[3].areashape:=AreaShape;
Sub_Pt[3].color:=131072 ;
Sub_Pt[3].tolerance:=Tolerance;

Sub_Pt[4].x:=175;
Sub_Pt[4].y:=109;
Sub_Pt[4].areasize:=AreaSize;
Sub_Pt[4].areashape:=AreaShape;
Sub_Pt[4].color:=131072 ;
Sub_Pt[4].tolerance:=Tolerance;

Sub_Pt[5].x:=172;
Sub_Pt[5].y:=104;
Sub_Pt[5].areasize:=AreaSize;
Sub_Pt[5].areashape:=AreaShape;
Sub_Pt[5].color:=131072 ;
Sub_Pt[5].tolerance:=Tolerance;

Herb_TDTM.MainPoint := Main_Pt;
Herb_TDTM.SubPoints := Sub_Pt;
Result := AddDTM(Herb_TDTM);
end;


procedure Get_Herb_Info(herb:string; var Herb_Text: TStringArray; var Herb_DTM: integer);

begin
case herb of
'Guam' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
for next:=0 to high(Herb_Text) do
writeln(Herb_Text[next])
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Marrentill' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Tarromin' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Harralander': begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Ranarr' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Toadflax' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'SpiritWeed' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Irit' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Wergali' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Avantoe' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Kwuarm' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Snapdragon' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Cadantine' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Lantadyme' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'DwarfWeed' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Torstol' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
'Fellstalk' : begin
if(Select_Task = 1)then
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Clean g', 'ean guam', 'an guam'];
end else
begin
Herb_DTM := SetHerbDTM(604423, 1980229);
Herb_Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
end;
end;


{function Store_Item(item: string,
begin

end; }


function Find_Item(x, y: integer; item: string): Boolean;
var
rightcount, downcount, Slotx, Sloty, DTM: integer;
text: TStringArray;
begin
Slotx := 31;
Sloty := 85;
rightcount := 0;
downcount := 0;
Get_Herb_Info(item, text, DTM);
repeat
repeat
if(FindDTM(DTM, x, y, Slotx, Sloty, Slotx + 44, Sloty + 44))then
begin
MMouse(x - 5, y - 5, 10, 10);
end;
Slotx := Slotx + 44;
rightcount := rightcount + 1;
until(IsUpTextMultiCustom([text]))or(rightcount >= 9)
Sloty := Sloty + 44;
Slotx := 31;
downcount := downcount + 1;
until(IsUpTextMultiCustom([text]))or(downcount >= 3)
if(IsUpTextMultiCustom([text]))then Result:= true;
end;

procedure Get_Item(item: string);
var
DTM,i: integer;
text: TStringArray;
begin
//if(Find_Item(x,y,item))then
//begin
//Store_Item(x,y,item)
//Mouse(x, y, 0, 0, false);
//end else writeln('Could not find ' + item);
Get_Herb_Info(item, text, DTM);
writeln(item)
for i:=0 to high(text) do
writeln(text[i])
end;


begin
ClearDebug();
//Smart_Server := 44;
SetupSRL();

//Withdraw_Herbs('Guam');
Get_Item('Guam')


end.

Kyle Undefined

2012-01-05 11:52:15

Or you could go pro with:


////////////////////Ignore This Part////////////////////////
program New; //
//{$DEFINE SMART} //
{$i srl/srl.scar}

type
THerb = record
Text : TStringArray;
DTM : Integer;
end;
//
var x,y,next :integer;



//
const //
////////////////////////////////////////////////////////////
Select_Task = 1; // 0 = Clean berbs. 1 = Make potions
Tolerance = 15;
AreaSize = 0;
AreaShape = 0;
////////////////////////////////////////////////////////////
///////////////////Begining of Script///////////////////////
////////////////////////////////////////////////////////////


function SetHerbDTM(Hcolor, Gcolor: integer): integer;
var
Sub_Pt: array[0..5] of TDTMPointDef;
Main_Pt: TDTMPointDef;
Herb_TDTM: TDTM;
begin
Main_Pt.x:=184;
Main_Pt.y:=103;
Main_Pt.areasize:=1;
Main_Pt.areashape:=0;
Main_Pt.color:=Hcolor;
Main_Pt.tolerance:=10;

Sub_Pt[0].x:=192;
Sub_Pt[0].y:=109;
Sub_Pt[0].areasize:=AreaSize;
Sub_Pt[0].areashape:=AreaShape;
Sub_Pt[0].color:=Gcolor; //This color is green or brown for clean or grimy
Sub_Pt[0].tolerance:=Tolerance;

Sub_Pt[1].x:=198;
Sub_Pt[1].y:=106;
Sub_Pt[1].areasize:=AreaSize;
Sub_Pt[1].areashape:=AreaShape;
Sub_Pt[1].color:=131072 ;
Sub_Pt[1].tolerance:=Tolerance;

Sub_Pt[2].x:=189;
Sub_Pt[2].y:=115;
Sub_Pt[2].areasize:=AreaSize;
Sub_Pt[2].areashape:=AreaShape;
Sub_Pt[2].color:=131072 ;
Sub_Pt[2].tolerance:=Tolerance;

Sub_Pt[3].x:=183;
Sub_Pt[3].y:=113;
Sub_Pt[3].areasize:=AreaSize;
Sub_Pt[3].areashape:=AreaShape;
Sub_Pt[3].color:=131072 ;
Sub_Pt[3].tolerance:=Tolerance;

Sub_Pt[4].x:=175;
Sub_Pt[4].y:=109;
Sub_Pt[4].areasize:=AreaSize;
Sub_Pt[4].areashape:=AreaShape;
Sub_Pt[4].color:=131072 ;
Sub_Pt[4].tolerance:=Tolerance;

Sub_Pt[5].x:=172;
Sub_Pt[5].y:=104;
Sub_Pt[5].areasize:=AreaSize;
Sub_Pt[5].areashape:=AreaShape;
Sub_Pt[5].color:=131072 ;
Sub_Pt[5].tolerance:=Tolerance;

Herb_TDTM.MainPoint := Main_Pt;
Herb_TDTM.SubPoints := Sub_Pt;
Result := AddDTM(Herb_TDTM);
end;


function Get_Herb_Info(herb:string) : THerb;
begin
case herb of
'Guam' : begin
if(Select_Task = 1)then
begin
with Result do
begin
DTM := SetHerbDTM(604423, 1980229);
Text := ['Clean g', 'ean guam', 'an guam'];
end;
end else
begin
with Result do
begin
DTM := SetHerbDTM(604423, 1980229);
Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
end;

// Repeated for each herb
end;
end;


{function Store_Item(item: string,
begin

end; }


function Find_Item(x, y: integer; item: string): Boolean;
var
rightcount, downcount, Slotx, Sloty : integer;
zHerb : THerb;
begin
Slotx := 31;
Sloty := 85;
rightcount := 0;
downcount := 0;
zHerb := Get_Herb_Info(item);
repeat
repeat
if(FindDTM(zHerb.DTM, x, y, Slotx, Sloty, Slotx + 44, Sloty + 44))then
begin
MMouse(x - 5, y - 5, 10, 10);
end;
Slotx := Slotx + 44;
rightcount := rightcount + 1;
until(IsUpTextMultiCustom([zHerb.Text]))or(rightcount >= 9)
Sloty := Sloty + 44;
Slotx := 31;
downcount := downcount + 1;
until(IsUpTextMultiCustom([zHerb.Text]))or(downcount >= 3)
if(IsUpTextMultiCustom([zHerb.Text]))then Result:= true;
end;

procedure Get_Item(item: string);
var
zHerb : THerb;
i : Integer;
begin
//if(Find_Item(x,y,item))then
//begin
//Store_Item(x,y,item)
//Mouse(x, y, 0, 0, false);
//end else writeln('Could not find ' + item);
zHerb := Get_Herb_Info(item);
writeln(item)
for i:=0 to high(zHerb.Text) do
writeln(zHerb.Text[i])
end;


begin
ClearDebug();
//Smart_Server := 44;
SetupSRL();

//Withdraw_Herbs('Guam');
Get_Item('Guam');


end.

bud_wis_er_420

2012-01-05 16:13:22

Thx alot i will look this over to see where I went wrong.

nickgrohe

2012-01-05 16:16:40

is there any ivy bot?

ShawnjohnSJ

2012-01-05 16:16:51

When passing variables, you need to put it like:
procedure proc(var i : Integer);

instead of

procedure proc(i : Integer);

Nick this isn't the place to ask for an ivy bot.. I suggest since you're new that you read the rules and use the search bar.

bud_wis_er_420

2012-01-05 16:18:02

From: Kyle Undefined
Or you could go pro with:


////////////////////Ignore This Part////////////////////////
program New; //
//{$DEFINE SMART} //
{$i srl/srl.scar}

type
THerb = record
Text : TStringArray;
DTM : Integer;
end;
//
var x,y,next :integer;



//
const //
////////////////////////////////////////////////////////////
Select_Task = 1; // 0 = Clean berbs. 1 = Make potions
Tolerance = 15;
AreaSize = 0;
AreaShape = 0;
////////////////////////////////////////////////////////////
///////////////////Begining of Script///////////////////////
////////////////////////////////////////////////////////////


function SetHerbDTM(Hcolor, Gcolor: integer): integer;
var
Sub_Pt: array[0..5] of TDTMPointDef;
Main_Pt: TDTMPointDef;
Herb_TDTM: TDTM;
begin
Main_Pt.x:=184;
Main_Pt.y:=103;
Main_Pt.areasize:=1;
Main_Pt.areashape:=0;
Main_Pt.color:=Hcolor;
Main_Pt.tolerance:=10;

Sub_Pt[0].x:=192;
Sub_Pt[0].y:=109;
Sub_Pt[0].areasize:=AreaSize;
Sub_Pt[0].areashape:=AreaShape;
Sub_Pt[0].color:=Gcolor; //This color is green or brown for clean or grimy
Sub_Pt[0].tolerance:=Tolerance;

Sub_Pt[1].x:=198;
Sub_Pt[1].y:=106;
Sub_Pt[1].areasize:=AreaSize;
Sub_Pt[1].areashape:=AreaShape;
Sub_Pt[1].color:=131072 ;
Sub_Pt[1].tolerance:=Tolerance;

Sub_Pt[2].x:=189;
Sub_Pt[2].y:=115;
Sub_Pt[2].areasize:=AreaSize;
Sub_Pt[2].areashape:=AreaShape;
Sub_Pt[2].color:=131072 ;
Sub_Pt[2].tolerance:=Tolerance;

Sub_Pt[3].x:=183;
Sub_Pt[3].y:=113;
Sub_Pt[3].areasize:=AreaSize;
Sub_Pt[3].areashape:=AreaShape;
Sub_Pt[3].color:=131072 ;
Sub_Pt[3].tolerance:=Tolerance;

Sub_Pt[4].x:=175;
Sub_Pt[4].y:=109;
Sub_Pt[4].areasize:=AreaSize;
Sub_Pt[4].areashape:=AreaShape;
Sub_Pt[4].color:=131072 ;
Sub_Pt[4].tolerance:=Tolerance;

Sub_Pt[5].x:=172;
Sub_Pt[5].y:=104;
Sub_Pt[5].areasize:=AreaSize;
Sub_Pt[5].areashape:=AreaShape;
Sub_Pt[5].color:=131072 ;
Sub_Pt[5].tolerance:=Tolerance;

Herb_TDTM.MainPoint := Main_Pt;
Herb_TDTM.SubPoints := Sub_Pt;
Result := AddDTM(Herb_TDTM);
end;


function Get_Herb_Info(herb:string) : THerb;
begin
case herb of
'Guam' : begin
if(Select_Task = 1)then
begin
with Result do
begin
DTM := SetHerbDTM(604423, 1980229);
Text := ['Clean g', 'ean guam', 'an guam'];
end;
end else
begin
with Result do
begin
DTM := SetHerbDTM(604423, 1980229);
Text := ['Grimy g', 'imy guam','my guam'];
end;
end;
end;

// Repeated for each herb
end;
end;


{function Store_Item(item: string,
begin

end; }


function Find_Item(x, y: integer; item: string): Boolean;
var
rightcount, downcount, Slotx, Sloty : integer;
zHerb : THerb;
begin
Slotx := 31;
Sloty := 85;
rightcount := 0;
downcount := 0;
zHerb := Get_Herb_Info(item);
repeat
repeat
if(FindDTM(zHerb.DTM, x, y, Slotx, Sloty, Slotx + 44, Sloty + 44))then
begin
MMouse(x - 5, y - 5, 10, 10);
end;
Slotx := Slotx + 44;
rightcount := rightcount + 1;
until(IsUpTextMultiCustom([zHerb.Text]))or(rightcount >= 9)
Sloty := Sloty + 44;
Slotx := 31;
downcount := downcount + 1;
until(IsUpTextMultiCustom([zHerb.Text]))or(downcount >= 3)
if(IsUpTextMultiCustom([zHerb.Text]))then Result:= true;
end;

procedure Get_Item(item: string);
var
zHerb : THerb;
i : Integer;
begin
//if(Find_Item(x,y,item))then
//begin
//Store_Item(x,y,item)
//Mouse(x, y, 0, 0, false);
//end else writeln('Could not find ' + item);
zHerb := Get_Herb_Info(item);
writeln(item)
for i:=0 to high(zHerb.Text) do
writeln(zHerb.Text[i])
end;


begin
ClearDebug();
//Smart_Server := 44;
SetupSRL();

//Withdraw_Herbs('Guam');
Get_Item('Guam');


end.



I wouldn't be able to use the shorter function Get_Herb_Info, because each result is gonna be different. Guam is a different color than snapdragon, etc.

bud_wis_er_420

2012-01-05 16:19:08

From: ShawnjohnSJ
When passing variables, you need to put it like:
procedure proc(var i : Integer);

instead of

procedure proc(i : Integer);

Nick this isn't the place to ask for an ivy bot.. I suggest since you're new that you read the rules and use the search bar.


ok great thx, I understand now.

yep it worked all i did was add in var

Kyle Undefined

2012-01-05 16:19:09

I shortened it because I wasn't going to repeat it for each one :p That's why I put the "// Repeated for each one".

bud_wis_er_420

2012-01-05 16:44:23

ohhhhhhh lmao. My bad. :duh: