Log in

View Full Version : Can include call scriptside proc?



Boreas
09-21-2006, 03:55 PM
Can an include file (that is being included by a script) call a procedure that is in the script?
Ex

//Include
procedure dosomething(num:integer);
begin
case num of
1: proc1
2: proc2
end;
end;

procedure reallybigproc(otherparameters, ddd);
begin
//stuff
dosomething(ddd);
//stuff
end;


//script
{.include upthere}

procedure proc1;
begin
end;

procedure proc2;
begin
end;

begin
//stuff
reallybigproc(someparams, 1);
//stuff
reallybigproc(someparams, 2);
//stuff
end.


The script writer can call the procedure multiple times, choosing which procedure the case of will choose. That part I know. But I want the script writer to be able to write proc1 and proc2 any way they want. (That's why proc1 and proc2 can't be in the include because the include writer can't predict them).




Also, can a procedure be a variable?
Ex


var
blah : procedure;

begin
blah := activateclient;
blah; //does activateclient
blah := setupsrl;
blah; //does setupsrl
end.


(obviously those examples don't work, I mean is there another way around it that would produce the same effect that these imaginary scripts would if they were real)



Edit: While I'm at it, what does gnome and chicken mean?

HISTORY
09-21-2006, 04:38 PM
Can an include file (that is being included by a script) call a procedure that is in the script?
Ex

//Include
procedure dosomething(num:integer);
begin
case num of
1: proc1
2: proc2
end;
end;

procedure reallybigproc(otherparameters, ddd);
begin
//stuff
dosomething(ddd);
//stuff
end;


//script
{.include upthere}

procedure proc1;
begin
end;

procedure proc2;
begin
end;

begin
//stuff
reallybigproc(someparams, 1);
//stuff
reallybigproc(someparams, 2);
//stuff
end.


The script writer can call the procedure multiple times, choosing which procedure the case of will choose. That part I know. But I want the script writer to be able to write proc1 and proc2 any way they want. (That's why proc1 and proc2 can't be in the include because the include writer can't predict them).




Also, can a procedure be a variable?
Ex


var
blah : procedure;

begin
blah := activateclient;
blah; //does activateclient
blah := setupsrl;
blah; //does activateclient
end.


(obviously those examples don't work, I mean is there another way around it that would produce the same effect that these imaginary scripts would if they were real)



Edit: While I'm at it, what does gnome and chicken mean?
havent tried this but if you knwo the name of the procedure you could use the forward;


ex procedure proc1; forward; you must put that before any of the prcedure s that useproc1

And the second question, no there was soemthing in pascal....a variable of a sort i think SwapProc ;
chicken is a type of living thing which you kill for food:P
gnome some weird illussion weird people create

Boreas
09-21-2006, 07:13 PM
Thanks History the forward thing worked like a charm, this makes things sooooo much easier. And as for the second question, that was only in case the first way didn't work. As for the chicken thing, do you not know or am I not supposed to be told? :P