![]() |
Error occured - Printable Version +- MFGG Forums (https://forums.mfgg.net) +-- Forum: MFGG (https://forums.mfgg.net/forumdisplay.php?fid=4) +--- Forum: Developer Discussion (https://forums.mfgg.net/forumdisplay.php?fid=10) +--- Thread: Error occured (/showthread.php?tid=2605) Pages:
1
2
|
Error occured - goh - 12-17-2020 I was creating a solid bubble item (You know, from Mario Advance). But the error has occured! Check here: Code: ERROR!!! :: ############################################################################################ RE: Error occured - Mors - 12-17-2020 Please post your development-related questions to Developer Discussion, and not Suggestions. I moved both of your threads for now though. As for your question, the error says that you did not set a variable called "item". Add a line like "item = 0;" to the create event of your object. RE: Error occured - Pedigree - 12-17-2020 (12-17-2020, 01:14 PM)goh Wrote: I was creating a solid bubble item (You know, from Mario Advance). But the error has occured!You are calling for .item variable before it has been set. Remove reference to the variable in the draw event and it should work fine. You cannot reference the object's variable when you are drawing it because the draw event happens before any other event on an object in Game Maker. (12-17-2020, 01:29 PM)Mors Wrote: As for your question, the error says that you did not set a variable called "item". Add a line like "item = 0;" to the create event of your object. Draw event happens before create event in Game Maker so that will not work as far as I know, it will still throw this error. RE: Error occured - Hyper - 12-17-2020 If you're using Game Maker 8/8.1, be sure to check "treat uninitialized variables as 0". If you're using Game Maker Studio, good luck on porting it. RE: Error occured - goh - 12-17-2020 (12-17-2020, 01:30 PM)Pedigree Wrote:(12-17-2020, 01:14 PM)goh Wrote: I was creating a solid bubble item (You know, from Mario Advance). But the error has occured!You are calling for .item variable before it has been set. Remove reference to the variable in the draw event and it should work fine. You cannot reference the object's variable when you are drawing it because the draw event happens before any other event on an object in Game Maker. I know. I'm using Game Maker Studio. Also another error occured too. Look here: Code: ERROR!!! :: ############################################################################################ RE: Error occured - CGWorks - 12-17-2020 it appears to be the same type of error you showed previously. In this case the variable name "item" has not been initialized by the time the draw event is reached. In the create event, put: item = 0 this should solve the problem RE: Error occured - goh - 12-17-2020 (12-17-2020, 03:00 PM)smbmaster99 Wrote: it appears to be the same type of error you showed previously. I did. And I'm focusing on this error now here: Code: ERROR!!! :: ############################################################################################ RE: Error occured - Pedigree - 12-17-2020 That is the same exact error you've already shown. The draw event occurs before the create event which means the variable won't be defined when you are calling for it, so you can't refer to the variable in that draw event. Remove all references to the "item" variable in the draw event and this error will no longer trouble you. What even are you trying to do with a variable in the draw event? Post the whole code of your draw event here. RE: Error occured - goh - 12-17-2020 (12-17-2020, 03:56 PM)Pedigree Wrote: That is the same exact error you've already shown. Okay, if you say so. Code: if item = 3 RE: Error occured - Pedigree - 12-17-2020 Ok I have no clue what you're trying to accomplish with that. Please provide some context to what this code is intended to do. If "item" is a variable for what item Mario is currently using (and thus would be defined on Mario), then you're not referencing Mario's item variable directly: For example: obj_mario.item would be how you'd reference that. Currently Game Maker thinks you're referencing obj_solidbubble's own item variable and it can't call on a variable before you have defined it. RE: Error occured - goh - 12-17-2020 (12-17-2020, 05:40 PM)Pedigree Wrote: Ok I have no clue what you're trying to accomplish with that.I'm trying to have that Mario Advance Solid Bubble to the game. I'm serious. RE: Error occured - Pedigree - 12-17-2020 You're talking about that bubble that holds items? You don't need to change the sprite in the draw event to change which item it's holding. You can change the sprite index in the step event based on the value of the item variable RE: Error occured - goh - 12-17-2020 (12-17-2020, 07:50 PM)Pedigree Wrote: You're talking about that bubble that holds items? How do I do that? RE: Error occured - Pedigree - 12-17-2020 In the step event: Code: if item = 0 { and so on. Your sprite names may be different. RE: Error occured - goh - 12-17-2020 (12-17-2020, 07:55 PM)Pedigree Wrote: In the step event: I'm using Hello Mario Engine. So you know. (12-17-2020, 07:59 PM)goh Wrote:Wait a minute, I'm talking about SMA1 solid bubbles, the ones that are hit by veggies! Not SMW bubbles.(12-17-2020, 07:55 PM)Pedigree Wrote: In the step event: RE: Error occured - Pedigree - 12-17-2020 (12-17-2020, 07:59 PM)goh Wrote: I'm using Hello Mario Engine. So you know. Ok, and? Quote:Wait a minute, I'm talking about SMA1 solid bubbles, the ones that are hit by veggies! Not SMW bubbles.The bubbles in SMA1 hold 1up mushrooms. Your draw event code seems to be changing the sprite index depending on whether or not it is holding an item or is empty. Either way, the code example I provided will help you. It really doesn't matter which bubble you're talking about, you don't need to change the sprite in the draw event. RE: Error occured - goh - 12-17-2020 (12-17-2020, 08:32 PM)Pedigree Wrote:(12-17-2020, 07:59 PM)goh Wrote: I'm using Hello Mario Engine. So you know. How do I really do that? I use Hello Mario Engine whatsoever. RE: Error occured - Hyper - 12-18-2020 Based on your error. You should definitely put item = 0; at the creation event as it always goes before any other event. You can assign custom items using instance creation codes in the room editor. The instance creation codes will run after the creation event. We're trying to help but the discussion keeps dragging on and going off a bit tangent. Regardless, as someone who's very experienced with Game Maker Studio 1.4. I would highly advise against porting a GMK (Game Maker 8.0) into a GMX. Especially Hello Engines and frameworks based on Hello Mario Engine. I've done it before with Gatete's SMB1 Engine (has similar logics compared to Hello Mario Engine). It's very tedious and difficult even for an experienced developer. If you can, I would advise to get a copy of the Game Maker 8.0 Pro. I'm sorry but you have to Google it for legal reasons. RE: Error occured - Mors - 12-18-2020 This thread is giving me a headache. (12-17-2020, 01:47 PM)Hypernova Wrote: If you're using Game Maker 8/8.1, be sure to check "treat uninitialized variables as 0".This is a terrible advice to give anyone as that option only allowed people to get away with terrible code and hid errors that would otherwise show up. Thank god they removed it in GMS... (12-17-2020, 07:50 PM)Pedigree Wrote: You're talking about that bubble that holds items?He isn't changing the sprite in the draw event, how did you come up to that conclusion? What his code does is that if the item number is 3 it draws the item with scaling. (12-18-2020, 01:54 AM)Hypernova Wrote: Regardless, as someone who's very experienced with Game Maker Studio 1.4. I would highly advise against porting a GMK (Game Maker 8.0) into a GMX. Especially Hello Engines and frameworks based on Hello Mario Engine. I've done it before with Gatete's SMB1 Engine (has similar logics compared to Hello Mario Engine). It's very tedious and difficult even for an experienced developer. If you can, I would advise to get a copy of the Game Maker 8.0 Pro. I'm sorry but you have to Google it for legal reasons. ??? Am I missing something here? He never even mentioned porting a GM8 game to GMS. Even then, it's tedious but often worth the effort considering how outdated GM8 is at this point. And goh, 3 different people gave you the answer, just add "item = 0" to the create event. That's all you gotta do to fix it. RE: Error occured - Hyper - 12-18-2020 mors Wrote:(12-18-2020, 01:54 AM)Hypernova Wrote: Regardless, as someone who's very experienced with Game Maker Studio 1.4. I would highly advise against porting a GMK (Game Maker 8.0) into a GMX. Especially Hello Engines and frameworks based on Hello Mario Engine. I've done it before with Gatete's SMB1 Engine (has similar logics compared to Hello Mario Engine). It's very tedious and difficult even for an experienced developer. If you can, I would advise to get a copy of the Game Maker 8.0 Pro. I'm sorry but you have to Google it for legal reasons. He didn't mention that he's porting it but he did asked for the source of SAB's Hello Engine 6 Fan Made on a different topic. I linked to the topic where Langton uploaded the source and it's in GMK format. They said they're using Game Maker Studio. As for the GM8 treating uninitialized variables, yeah it's the lazy way to resolve the issue and not helpful in the long run. |