Community
SCI Programming => Mega Tokyo SCI Archive => Topic started by: Trig on May 23, 2002, 08:52:22 AM
-
I was perusing through the SCI Studio documentation, but was unable to find a particular piece of information. In the SCI Studio Language, is there any syntax to check the parameter count of the current method or access the parameters by index?
For Example:
(method (Example params)
(var index)
(=index 1)
(while (index < ParamCount)
(+= params[index] 5)
(++ index)
)
)
In the fantasy land where this code would be correct, it would add 5 to every parameter passed to the method, allow any number of parameters from 0 to a bunch, and be able to reference parameters not specifically identified in the method's declaration.
Is there a way to accomplish this in SCI Studio?
-
Yes there is! SCI Studio supports a keyword named "paramTotal". Here's an example of it's use:
(method (setFeatures features)
(var i)
(for (= i 0) (< i paramTotal) (++i)
(send gFeatures:add(features))
)
)
Thanks for pointing this out. I must have forgot to add it to the help file.
PS. I'm almost done documenting the class system, and labelling all the variables in the template game (ie. temp123->"name" and param245->"another_name"). It will be here soon!