Forum rules - please read before posting.

Set variable with keypress

edited August 2014 in Technical Q&A
Ive got a trigger which checks for input on the enter key, but how do I make it so if the condition is met (ie enter key is down) then I can set a global variable ?

Comments

  • You can use AC.GlobalVariables.SetIntegerValue(id number of the variable, desired value);

    You can replace Integer with Boolean and Float too. And the value does not have to be a plain number, if you want to increase or decrease by one for instance just fill in +1 or -1 for the desired value.

    Instead of Set you can also Get.

    You can find the variable id in the AC Variables manager tab.
  • thanks very much! It works :) do you know how I get and set from the inventory in code ? I want to be able to reduce the amount of money in the players inventory but from an independent script, not from a AC action.
  • Great :) I don't know yet how to handle inventory items in code, I've tried to find the reference to it but nothing useful yet. Maybe take a look in ActionInventorySet.cs to see how the action does it, maybe you can borrow code from there. Otherwise ChrisIceBox will know.
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.