SRL Archive - OSR Help

script options help


pulse0

2013-02-18 14:39:15

can anyone point me to a tut or can somebody explain how to add options in my scripts with integers? im looking to make a chop and burn/powerchopper script with multiple tree support and was wondering how to make options to say either chop and burn or chop and drop 1 type of tree or the other. hope im making sence, any help is greatly appreciated

Ian

2013-02-18 15:06:21

Use cases :)

At the beginning, have a constant like:
const

Option = 'burn'; //Burn or Drop
TreeType = 'yew'; //yew, oak, normal, willow

When you want to chop the logs you can make separate procedures for each tree have something like

case Lowercase (TreeType) of
'normal': ChopNormal;
'oak': ChopOak;
'willow': ChopWillow;
end;
(not as good, but maybe a good starting point)

or

Use cases to declare the tree information at the beginning of the script like this, and call this procedure when you start your script:
procedure LoadTreeInfo;
begin
case Lowercase (TreeType) of
'normal':
begin
TreeUptext := 'p Tr';
TreeColor := 626421;
TreeTol := 5;
end;
'oak':
begin
TreeUptext := 'p Oa';
TreeColor := 6054506;
TreeTol := 4;
end;
end;
end;

and then in your tree finding procedure replace the tree color with TreeColor, ect.
If you do this method you'll need to declare the things like TreeTol as global variables at the beginning.


When you want to get rid of the logs have something like

case Lowercase (Option) of
'burn': BurnLogs;
'drop': DropLogs;
end;

I just typed this in the browser but this should give you a general idea :)

pulse0

2013-02-18 15:30:00

From: BMWxi
Use cases :)

At the beginning, have a constant like:
const

Option = 'burn'; //Burn or Drop
TreeType = 'yew'; //yew, oak, normal, willow

When you want to chop the logs you can make separate procedures for each tree have something like

case Lowercase (TreeType) of
'normal': ChopNormal;
'oak': ChopOak;
'willow': ChopWillow;
end;
(not as good, but maybe a good starting point)

or

Use cases to declare the tree information at the beginning of the script like this, and call this procedure when you start your script:
procedure LoadTreeInfo;
begin
case Lowercase (TreeType) of
'normal':
begin
TreeUptext := 'p Tr';
TreeColor := 626421;
TreeTol := 5;
end;
'oak':
begin
TreeUptext := 'p Oa';
TreeColor := 6054506;
TreeTol := 4;
end;
end;
end;

and then in your tree finding procedure replace the tree color with TreeColor, ect.
If you do this method you'll need to declare the things like TreeTol as global variables at the beginning.


When you want to get rid of the logs have something like

case Lowercase (Option) of
'burn': BurnLogs;
'drop': DropLogs;
end;

I just typed this in the browser but this should give you a general idea :)


Thanks a lot! Thats clears things right up. +rep