[r65] Global and local variables not accepted

  • Global and local variables not accepted in an expression.

    http://www.amirai.net/bugs/variablebug.capx

    Try either action, setting the variable unit.targettedby to the global or local variable doesn't work, claiming it's an "invalid value for 'value' - you cannot set a string to the number value targettedby."

    Vista 32bit.

  • New clues - now I can't even make the most basic .cap with setting a sprite's variable to a global variable even with a fresh .cap. I think it might have started happening after changing a local variable's scope level and then undoing.

    Deleting the registry key didn't fix it. Reinstalling didn't fix it. Opening up an event sheet in a text editor and manually entering the variable there, then reloading, works.

  • I might be misunderstanding what you are saying in your first post, but if you wrap the global or local variable with int(), then it accepts the value, i.e. unit.targettedby = int(value).

    As far as I know, it has always worked like this in C2. At least, that's how I have always had to do it.

  • Hmm, that does work - they seem to be accepted as parts of other expressions too, like distance. Shouldn't that not be necessary, though?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think I might know what's going on - I think C2 is mixing up what type of variables they are somewhere. It complains based upon the type of variable I'm setting. If it's a string I'm trying to set, regardless if the variable is a number or string it complains about me trying to enter a number to a string variable, and the other way around when setting number variables.

  • I agree, it doesn't seem like it should be that way. I just assumed it was that way for reason and never questioned it. <img src="smileys/smiley24.gif" border="0" align="middle" />

  • Thanks, fixed in next build.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)