Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Janik on Thu 03/11/2005 04:37:37

Title: Suggestion: More parameters for run-script
Post by: Janik on Thu 03/11/2005 04:37:37
Hi,

I would like to suggest allowing several parameters to the run-script command in dialogs, say, four or five integers. The way I would use it would be, for example:

run-script 101, 2, 5

where 101 is a command ID, say that here this is to change the expression used in the speech view;
2 would be the character ID;
5 would be the loop to use.

an other parameter might allow for a delay before changing the expression, etc. All the parameters (other than the first) would be optional. With many parameters, it makes it possible to do a lot from within a dialog script with much less code, and in a much more maintanable way.

Thanks!
Title: Re: Suggestion: More parameters for run-script
Post by: Gilbert on Thu 03/11/2005 05:15:55
It can be handy having that, so maybe the dialog_request() function can be defined like this:

function dialog_request(int val1, int val2=0, int val3=0, int val4=0, int val5=0) { ...}
Having optional parameters makes it flexible.


However, it's currently possible with a not-so-annoying method, like:
Dialog Script:
set-globalint 10 2
set-globalint 11 5
run- script 101

dialog_request():
if (value==101) {
  int charid=GetGlobalInt(10);
  int charview=GetGlobalInt(11);
  bla bla bla...


I think it's not of high priority.
Title: Re: Suggestion: More parameters for run-script
Post by: Elliott Hird on Thu 03/11/2005 09:15:03
A bit clogged up really...

You should just do what gilbot suggested really, I don't think that many people would use it.
Title: Re: Suggestion: More parameters for run-script
Post by: Janik on Thu 03/11/2005 16:26:06
Yes, it's a reasonable work around. Though the optional parameters to dialog_request would make it less clogged-up, definitely not more.
Title: Re: Suggestion: More parameters for run-script
Post by: Pumaman on Fri 04/11/2005 22:13:56
Really I'd like to change the whole way this works, dialog_request is rather a messy way of doing it. However, I'm still not sure what the best solution is.
Title: Re: Suggestion: More parameters for run-script
Post by: Janik on Sat 05/11/2005 07:01:46
Hmm, how about having a chunk of script code right there in the dialog script? Perhaps just have curly brackets indicate the start/end of it.

For example:

@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
{
cOtherman.Walk(220, 330, eBlock);
cOtherman.LockView(12);
cOtherman.Animate(0,0, eOnce, eBlock, eForwards);
cOtherman.UnlockView;
}
otherman: ...
otherman: "I'm fine."
return


I'm not sure how that would work behind the scenes - perhaps each code block would have a function automatically created for them - sort of like an on-the-fly dialog_request().
But it would be very neat, keeping all the related conversations and code together.
Title: Re: Suggestion: More parameters for run-script
Post by: Pumaman on Sat 05/11/2005 12:59:50
That would be a really handy way of doing it; how practical it is depends on technical considerations though, but I'll certainly think about it.
Title: Re: Suggestion: More parameters for run-script
Post by: Elliott Hird on Sat 05/11/2005 19:07:28
how about run_script myscript 1 2 3 calls dialog_myscript(1, 2, 3); and dialog_myscript would be defined as function dialog_myscript(int 1, optional int 2, optional int 3) - this would allow varible amount of paramaters, and would be similar to the gui _click functions.
Title: Re: Suggestion: More parameters for run-script
Post by: strazer on Sat 05/11/2005 20:34:07
Quote from: Janik on Sat 05/11/2005 07:01:46
Hmm, how about having a chunk of script code right there in the dialog script? Perhaps just have curly brackets indicate the start/end of it.

That looks really neat. I hope something like this can be implemented.

Edit:

Tracker'd: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=550