SRL Archive - OSR Help

Counter for a script / Question


joj0r

2012-04-17 10:39:26

Hey dudes i am using a free firemaking script from that forum. For Personal Use i wanted to add a Log/h Counter, but it's not working
in the procedure DeclarePlayer i've addet this
Log:='Teak'; // Please Type in the Logs you are Burning, For Process Report //Logs,Achey,Oak,Willow,Teak,Maple,Mahogany,Arctic,Eucalyptus,Yew,Magic //
Log is string

Then at the proggy procedure i've addet this

if log ='Logs'
then XPL :=40
else if Log ='Achey'
then XPL :=40
else if Log ='Oak'
then XPL :=60
else if Log ='Willow'
then XPL :=67.5
else if Log ='Teak'
then XPL :=105
else if Log ='Maple'
then XPL :=135
else if Log ='Mahogany'
then XPL :=157.5
else if Log ='Arctic'
then XPL :=140.2
else if Log ='Eucalyptus'
then XPL :=193.5
else if Log ='Yew'
then XPL :=202.5
else if Log ='Magic'
then XPL :=303.8
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
XPL (XP per Log) is integer, my problem is that it won't compile. What am i doing wrong? Thanks for answer =]
also tried other variables for XPL like LongInt, but none is working

tehq

2012-04-17 10:45:50

Just use a case :)
const
log = 'magic';
var
XPL: Integer;
begin
case lowercase(Log) of
'logs': XPL:= 40;
'achey': XPL:= 40;
'oak': XPL:= 60;
'willow': XPL:= 67;
'teak': XPL:= 105;
'maple': XPL:= 135;
'mahogany': XPL:= 157;
'artic': XPL:= 140;
'eucalyptus': XPL:= 193;
'yew': XPL:= 202;
'magic': XPL:= 304;
end;
WriteLn(XPL);
end.

eska

2012-04-17 10:53:02

That's the biggest if/else statement I've ever seen on this forum.

Abu

2012-04-17 10:54:33

From: sir eska eau
That's the biggest if/else I've ever seen on this forum.


Correction - that's the pointiest is/else you've ever seen on this forum.

I mean you could stab someone with that….



OT: Yeh tehq pretty much said it all, cases is your best friend here mate ;)

riwu

2012-04-17 10:56:04

u declare XPL as integer but clearly some of ur XPL is not integer (whole numbers) but decimals instead. Try declare XPL as extended, or Round ur XPL to integers.

joj0r

2012-04-17 15:56:49

allright guys thanks a lot for helping =) tehq i will try this =)
eska&abu, i know^^ i am new into runescape scripting, just had pascal in school and we made all with if then else variables, i will look forward into pascal scripting for rs =) thanks

Oxygen

2012-04-17 16:48:24

From: abu_jwka
Correction - that's the pointiest is/else you've ever seen on this forum.

I mean you could stab someone with that….



OT: Yeh tehq pretty much said it all, cases is your best friend here mate ;)


*if/else
But things can always be pointer :D
Cases. But is there any other way than cases?