local variable problems

Get help using Construct 2

Post » Wed Dec 19, 2012 12:39 pm

hey there i'm having trouble with my local variables, they used to be global variables but that screwed my game over when it came to the Hard level as all my text boxes where just said text, anyway back to the point what i dont understand is when i enter the text as shown here that error message comes up and i cant make heads or tales of it, that is all i need to figure out how to fix then my games is finally done. also here is a dropbox link to the game in case you want to have a root around https://www.dropbox.com/s/50i46mty1wolkca/maze.capx

Thanks in advance for all your help :)Bammy2922012-12-19 12:40:43
B
4
Posts: 19
Reputation: 463

Post » Wed Dec 19, 2012 1:13 pm

Sorry I won't download a 18 Mo capx, but the error message is pretty self explaining.

ScoreHard is an object type, not a variable.
So it needs some more properties to be used, or possibly an instance variable name.
Something like ScoreHard.myScore, or whatever the name of your variable is.

Check in the list on the right, the project objects tab, you should find this object there.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Dec 19, 2012 2:51 pm

ah ok i will try that and let you know how i get along :) did not know the file was that big i will have to compress it :)
B
4
Posts: 19
Reputation: 463

Post » Wed Dec 19, 2012 4:18 pm

agreed check to see if your using an object and not a variable. However if it is a variable make sure it's in the same scope.

Which could be a global which is freely open and if it's a group make sure your reference is in the same grouping. I've done this a couple of times where I try to use a var which is in a different group :D
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Wed Jan 09, 2013 9:35 am

hate to be a pain but what you said makes no sense to me.
B
4
Posts: 19
Reputation: 463

Post » Wed Jan 09, 2013 10:35 am

still having trouble :( anyone got any ideas?
B
4
Posts: 19
Reputation: 463

Post » Wed Jan 09, 2013 10:37 am

Where you have you reference

"Score: " &

The next part needs to link to where the variable data is stored.

ObjectsName.VariableName

Your box should now look like this

"Score: " & ObjectsName.VariableName

The error should now be resolved if all the data is correct.
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Wed Jan 09, 2013 10:40 am

Interesting... how did you do that? You have 3 local number variables, but they do not appear to be tied to anything. Can you perhaps try generating Global Variables instead, and using them in the expression? Just right click in the event editor and click on add global variable.

Do you know how you made those local variables? I can add more to your event editor, but cannot add a new one from scratch.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 930
Reputation: 9,358

Post » Wed Jan 09, 2013 10:45 am

[QUOTE=AnD4D]Do you know how you made those local variables? I can add more to your event editor, but cannot add a new one from scratch.[/QUOTE]

Local variables are made inside events, if you create variable inside an event that is triggered it automagically becomes local variable.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Wed Jan 09, 2013 10:49 am

i was using local variables because my games has 2 levels normal and hard and for some reason one blocks the other out so the text boxes just come up saying text instead of showing you your health score and time, i find construct rather confusing so if i come back saying i don't have a clue what you said then don't be offended :)
B
4
Posts: 19
Reputation: 463

Next

Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Axiomaltd, MACPK, nicklowkcmagic, OddConfection and 22 guests