Scripting, Code & Interaction: Difference between revisions

Line 226: Line 226:


...will set '''x''' 's value to 85 (the sum of 24 and 61, as calculated in the function). That's all there is to it!
...will set '''x''' 's value to 85 (the sum of 24 and 61, as calculated in the function). That's all there is to it!
Note that if you create a function using the keyword '''function''' then it can only return integer values.  Bools and enumerated values (AGS 2.7+) have integer equivalents, as do chars and shorts.  But if you want to return a pointer (such as a Character* or a String) then you '''have''' to replace function with the return type!  So, to return these types you should set up your functions like this:
  ''return_type func_name([param_type_1 param_1 [, param_type_2 param_2 [, ...]]])''
And just in case you're confused about the '[' and ']' in there, that just means that it's something you don't have to include. Your functions don't have to have any parameters, and they can have up to 9.


==Defining custom hotkeys and shortcuts==
==Defining custom hotkeys and shortcuts==
Anonymous user