[r65] Global and local variables not accepted

Bugs will be moved here once resolved.

Post » Mon Oct 31, 2011 9:56 am

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.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Oct 31, 2011 4:19 pm

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.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Oct 31, 2011 4:40 pm

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.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Mon Oct 31, 2011 4:55 pm

Hmm, that does work - they seem to be accepted as parts of other expressions too, like distance. Shouldn't that not be necessary, though?
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Oct 31, 2011 4:59 pm

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.Arima2011-10-31 17:02:47
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Oct 31, 2011 5:10 pm

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.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Fri Nov 04, 2011 4:42 pm

Thanks, fixed in next build.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,208


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests