SRL Archive - Test corner

function smelt(Oretype:string):Boolean


Gravey

2006-04-22 23:27:25

Made this for the smelter I'm making, should be very usefull in most cases.

procedure smelt(Oretype:string); // Copper, Iron, Silver, Steel, Gold, Mith, Addy and Rune
begin
if(Oretype = 'Copper')then
begin
Mouse(56, 404, 6, 6, true)
end;
if(Oretype = 'Iron')then
begin
Mouse(114, 404, 6, 6, true)
end;
if(Oretype = 'Silver')then
begin
Mouse(171, 403, 6, 6, true)
end;
if(Oretype = 'Steel')then
begin
Mouse(228, 402, 6, 6, true)
end;
if(Oretype = 'Gold')then
begin
Mouse(286, 405, 6, 6, true)
end;
if(Oretype = 'Mith')then
begin
Mouse(343, 404, 6, 6, true)
end;
if(Oretype = 'Addy')then
begin
Mouse(399, 404, 6, 6, true)
end;
if(Oretype = 'Rune')then
begin
Mouse(457, 404, 6, 6, true)
end;
end;

Dark_Sniper

2006-04-22 23:54:50

nice :) if i use this you dont mind if i edit it a bit do ya :p.

and it should be a procedure not a function.

Gravey

2006-04-23 00:19:41

NO YOU CAN'T! Jk, go ahead, just give credit where needed. :D

Pyro

2006-04-23 02:14:46

nice just a few tips. If its just one line after the then you dont need the begin and ends. its just
if(whatever) then mouse(x,y,6,6,true)

I did somethign likes this but the y always stays the same and only the x moves so i just made it specify the x value then just have the mouse at the end.

Dark_Sniper

2006-04-23 03:03:18

ya t6hat makes it simpler but it seems ok now :p

heres the edited code i will use :p it first finds the furnace then smelts :p and waits until ore is gone.

{.include SRL\SRL.scar}

function smelt(Oretype:string):boolean;
begin
FindObj(x, y, 'Smelt', 2763308, 30)
mouse(x, y, 0, 0, false)
wait(200+random(200))
chooseoption(x, y, 'Smelt')
wait(1000+random(100))
if(Oretype = 'Copper')then
begin
x:=56
end;
if(Oretype = 'Iron')then
begin
x:=114
end;
if(Oretype = 'Silver')then
begin
x:=171
end;
if(Oretype = 'Steel')then
begin
x:=228
end;
if(Oretype = 'Gold')then
begin
x:=286
end;
if(Oretype = 'Mith')then
begin
x:=343
end;
if(Oretype = 'Addy')then
begin
x:=399
end;
if(Oretype = 'Rune')then
begin
x:=457
end;
mouse(x, 404, 6, 6, true)
repeat
smelt(oretype)
if(not(isuptext('Use')))then
result:=true;
until(result=true)
end;

and thats what pyro was talking about.

and the diffrence between a procedure and a function is that function has a built in variable… result which as you can see i used.

XxKanexX

2006-04-23 04:16:44


procedure Smelt(oreNumb: integer);
var xx: integer;
begin
if (oreNumb > 8) then
exit;
xx:= 57 * oreNumb;
Mouse(xx, 405, 3, 3, true);
end;

Dark_Sniper

2006-04-23 13:15:01

lol i need to learn SRL inside and out like you have kane.

XxKanexX

2006-04-23 13:44:30

That required no SRL skill lol.. Just simple maths. 0.o

Gravey

2006-04-23 19:13:31

From: XxKanexX
That required no SRL skill lol.. Just simple maths. 0.o


Eeeeeeeew, math.

WhiteShadow

2006-04-23 19:16:26

From: Gravey
Eeeeeeeew, math.


JUst multiplication, you'll live. :-p

Pwnd

2006-04-23 19:34:47

From: WhiteShadow
JUst multiplication, you'll live. :-p

<3 Imaginary numbers.

Pyro

2006-04-24 17:34:26

From: Pwnd
<3 Imaginary numbers.


O for sure. square root of -5?

But anyways nice thing there gravey. dont take the comments the wrong way.

Gravey

2006-04-24 22:53:16

From: WhiteShadow
JUst multiplication, you'll live. :-p

EEEEEEEEEW Math.

And ty Pyro, I wasn't really expecting to get any replies at all.

Dark_Sniper

2006-04-24 23:01:15

lol with most effort comes applause :)