Problem with global variable

Started by jojo073, Thu 07/02/2019 16:50:25

Previous topic - Next topic

jojo073

Hello, recently I'm trying to make a game with this utility, so far I've managed to get where I wanted, but right now I'm somewhat stuck due to lack of experience.

I have thought about making a global variable that saves the value of time and depending on that time, because the characters have dialogical determiner, you can enter places and things happen in the adventure.
I went to the panel of the global variables and there I defined a numeric type "int" I gave it the initial value of 1, its name is: vtiempo

Now I want to make a condition in such a way that the program distinguishes if the value of the variable is 1 that goes to the character and talk to him and if not then go to another site.
I went to the Globalscript.asc section and there I wrote this
Code: ags

// talk to the guard 1
function cguardia_Talk ()
{
  if (vtiempo = 1)
  {
  cjavier.Walk (384, 310, eBlock, eWalkableAreas);
  cjavier.FaceCharacter (guard);
  dDialog1.Start ();
  }
else
  {
  // if the time is different
  cjavier.Walk (184, 310, eBlock, eWalkableAreas);
  }
}



I know it's silly but I've searched the manual and examples of if, else and I do not understand why it gives an error.
parse error in expr near time

greetings and thanks

Slasher

#1
Code: ags


if (vtiempo == 1)  // == Is equal to.  Not =


Look up Operators in the manual...

Also it's common practice to name things like characters preceded with a c as in cguard. o for Objects like oguard etc etc.


SMF spam blocked by CleanTalk