• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

ERROR: REAL argument is array

J

Jimmy Boy

Guest
Just opened this project to mess around with it, and I've got an error coming up that says "REAL argument is array". I don't remember it coming up last time I was working on it. Has anyone seen this error message before?

It's occurring at these lines:
Code:
var bar_width = sprite_get_width(spr_smw_barmeter);
var bar_height = sprite_get_height(spr_smw_barmeter);
 

Attachments

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
The error claims that the value [that you passed into sprite_get_width] is an array. If it's a variable, try running the game with the debugger and seeing what is up.
 

TheouAegis

Member
What version of GM are you using? It looks like you're using an actual resource name, but you shouldn't be able to create a new array with the same name as a resource (it should throw naming conflict errors). Did you change the name of the sprite at some time? Or did you somehow manage to give the sprite name brackets?
 
J

Jimmy Boy

Guest
What version of GM are you using? It looks like you're using an actual resource name, but you shouldn't be able to create a new array with the same name as a resource (it should throw naming conflict errors). Did you change the name of the sprite at some time? Or did you somehow manage to give the sprite name brackets?
I'm Using GMS2 v2.2.3.436. I didn't name the resource with any brackets. Heck, I can't find anywhere in the code I used that name with brackets. I'm also not finding any naming conflict errors. Although I did (in the last five minutes) change the name of the sprite (and all references to it) to "spr_meter" just to see if that would change anything. Nope. Still the same error. I haven't the slightest understanding how I managed to trick GM into thinking that a sprite is an array. I'm honestly kind of impressed with myself! XD

I'm gonna try setting up the code a bit differently and see if I can't figure this out.

The error claims that the value [that you passed into sprite_get_width] is an array. If it's a variable, try running the game with the debugger and seeing what is up.
I tried running the debugger, but honestly, I'm not too familiar with the debugger yet, and I didn't see anything in debug mode that struck me as an obvious issue with the code I've written. The mystery continues...

Oh! I forgot to mention. "spr_smw_barmeter" was indeed the name of a sprite resource, not a variable.

I FIGURED OUT THE PROBLEM.

The problem was on line 2 (where I actually was mistakenly referencing an array as a variable), but GM was telling me that the problem was on line 4. I tried commenting out line 2, and it fixed it. Wooh!

Thanks for the responses, though!

Moderator Edit: Posts merged. Please use the Edit button instead of posting several times in a row.
 
Last edited by a moderator:
Top