PDA

View Full Version : two scripts in one?



bbri06
11-28-2006, 02:37 AM
well here is my question tell me if you need more clarification
is it possible to put 2 or more scripts into one script and then have the main script have a choice to use either one of those 2 inside of it?

such as


program 2scripts;

const
usescripta=true;

program scripta;
begin
end.

program scriptb;
begin
end.

procedure choose;
begin
if(usescripta=true)then
begin
scripta;
end else
begin
scriptb;
end
end;

begin
choose;
end.




i know that wont work but that is just an example incase you didnt understand my description

IronTeapot
11-28-2006, 02:47 AM
Yes. You set them up as includes. where the 'main' procedure of scripta and scriptb are callable procedures. Then call to them in your main script.

bbri06
11-28-2006, 03:11 AM
could you plz give me an example i think i know what you meen but im not sure

CamHart
11-28-2006, 03:32 AM
Or you could just set them up as procedures and run them inside one program.

shadowblade
11-28-2006, 05:07 AM
if you look at the giuld miner by wt fakawi ull see that they hav another script for anti randoms and anti ban

bbri06
11-28-2006, 05:18 AM
ok i have started to mess with some stuff and have got the idea working. Thanks!

Pentti
11-28-2006, 12:45 PM
Would you mean something like this:

program TwoScripts;
var x,y:integer;
AScript,BScript:string;

const Script='BScript'; //Run with AScript or BScript


//A//A//A//A//A//A//A//A//A//A//A//A
procedure A1;
begin
writeln('A')
end;

procedure A2;
begin
getmousepos(x,y)
Movemouse(x+50,y+50)
end;
//A//A//A//A//A//A//A//A//A//A//A//A


//B//B//B//B//B//B//B//B//B//B//B//B
procedure B1;
begin
writeln('B')
end;

procedure B2;
begin
getmousepos(x,y)
ClickMouse(x+20,y+20,true)
end;
//B//B//B//B//B//B//B//B//B//B//B//B


//A//A//A//A//A//A//A//A//A//A//A//A
procedure A; //Main loop of A Script
begin
A1;
A2;
end;
//A//A//A//A//A//A//A//A//A//A//A//A
// \\
//B//B//B//B//B//B//B//B//B//B//B//B
procedure B; //Main loop of B Script
begin
B1;
B2;
end;
//B//B//B//B//B//B//B//B//B//B//B//B

procedure Choise; //Choises A or B script and runs with it
begin
case Script of
'AScript': A;
'BScript': B;
end;
end;

begin
Choise;
end.

tarajunky
11-28-2006, 04:22 PM
Yeah, there is no reason you couldn't have two or three or ten scripts inside one. There was a guy working on a PlayVarrock script that would randomly pick out one of like 5 different activities and do that. You could have it fight guards, or have it smith bars, or have it mine at the east mine or the west mine, or you could have it sell items to the store, or have it chop trees/oaks/etc.

All you need to do is have each of those scripts work correctly on their own, and then lump them all together with a little bit of code to transition between them.

bbri06
11-28-2006, 11:20 PM
kk tyvm