Forum rules - please read before posting.

How to use Global/Local Variable as Parameter?

The tutorials on using Parameters in Actionlists are very useful, but I can't seem to find a tutorial on how to use a Global or Local Variable as a a Parameter. I tried to code it by emulating code in other actions but just can't seem to get it working. Appreciate it if there is a tutorial on how to do this. Thanks!

Comments

  • You can choose Global or Local variable in the dropdown list for parameter type. Then when you run that actionlist from another, there will be an option for what variable to send it.
  • Indeed.  The use of such parameter types is limited to only a few Actions and fields.  What field exactly is it you're trying to set via parameter?
  • Sorry, let me clarify. I don't mean how to use them in existing actions, that I know. I meant how to write a Custom Action which implements the use of a Global or Local variable in parameters. I kinda got the ShowGUI part to work, but the AssignValues don't seem to be working.
  • Ah, right.  In AssignValues, you just need to use:

    myVarID = AssignVariableID (parameters, myVarParameterID, myVarID);

    Where "myVarID" is the ID number of the global/local variable to be used, and "myVarParameterID" is the ID number of the parameter that refers to either a global or local variable.

    It is admittedly a bit confusing because it's the ID of the parameter, not the variable itself, that is referenced in myVarParameterID.  The method then checks if the referenced parameter is either of type Global Variable or Local Variable, and then returns the ID number of the variable in question.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.