Hoohee
|
|
Posted on: December 18, 2017, 09:42:56 pm |
|
|
Joined: Aug 2017
Posts: 40
|
Self-quote, from the other thread: I may have discovered another bug. For some reason, turning on a user-defined variable (by holding a button) messes with a character's movement. The character either stops moving, or moves in weird ways. I haven't been able to duplicate this in my experiment file (the "Jump" one), but I'll keep trying to figure out what's wrong. In the meantime, if this helps, the character's movement uses variables as well; the hspeed and vspeed variables in the "Step" event.
Last I checked, this was never solved in the original thread I posted it in. That's partially my fault. As I am having this issue in a game I made in GM8 and hope to sell--and was also hoping to port to Enigma--I declined to provide the file. I attempted to duplicate the bug with a new game specially made to duplicate this issue, but I couldn't. I'd appreciate all the help I can get in digging up what might be causing this issue. Admittedly, that might not be too easy without me providing the game, but maybe we can work something out. Note that I actually can provide the code for the parts of my game that have this problem.
|
|
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #1 Posted on: December 22, 2017, 06:27:39 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
You can ignore TKG; he gets that way literally all the time.
It's okay if you don't want to provide the file. Can you provide a small test case that demonstrates what ENIGMA is doing incorrectly?
We can skip that if you provide more details on what variable you're setting. You say "a user-defined variable"—what is its name? It may be interfering with an ENIGMA system variable, or a variable that ENIGMA provides for backward-compatibility. For instance, setting image_single will stop an instance's sprite animation. This behavior was removed from Game Maker, as far as I know.
There are also minor differences in the way ENIGMA handles code. A good example is using a function name as a variable. I doubt you're hitting any of that, based on the fact that your game will start up and run fine.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Hoohee
|
|
Reply #2 Posted on: January 05, 2018, 08:11:28 pm |
|
|
Joined: Aug 2017
Posts: 40
|
I apologize for taking so long to respond to this; I was on a trip. The variable's name is "Vacuum". Incidentally, when it loaded up, I also saw this alert: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:2279:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(action_if_variable(enigma::varaccess_Vacuum(int(self)), 1, 0))
What are "explicit braces"?
|
|
|
Logged
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #4 Posted on: January 06, 2018, 11:29:59 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
To my knowledge, "Vacuum" is not a reserved word... do you have a resource by that name? Are you using that variable in any movement logic? There may be a difference in event execution order that is causing your logic to behave differently in ENIGMA when compared to GM.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
hpg678
|
|
Reply #5 Posted on: January 06, 2018, 02:01:00 pm |
|
|
Location: Barbados Joined: Mar 2017
Posts: 283
|
i have a theory in mind but before I voice it, could you send the segment of code involving the variable as well an explanation for its use?
|
|
|
Logged
|
[compromised account]
|
|
|
Hoohee
|
|
Reply #6 Posted on: January 06, 2018, 04:12:22 pm |
|
|
Joined: Aug 2017
Posts: 40
|
Ok; so the bits involving Vacuum aren't text code, but Drag & Drop, but I can provide some things. I copied the text that appeared in Debug, and so here are the parts involving Vacuum. Add dot accessed local Vacuum C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:2376:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(action_if_variable(enigma::varaccess_Vacuum(int(self)), 1, 0)) ^
And as to the Drag & Drop stuff in the actual game. First for the object that has the vacuum. In Create: Set Vacuum to 0 In Press Q: If Fuel is less than 16 If Vacuum is equal to 0 Set variable Vacuum to 1 In Release Q: If Vacuum is equal to 1 Set variable Vacuum to 0 Now for the objects that get vacuumed. In Normal Step: If Vacuum is equal to 1. (NOTE: For the other object.) If at position (x,y) there is an instance of object object_Suction Start of block Move towards point (object_Mouth.x,object_Mouth.y) End of block Else Start moving in one of directions 000010000 with speed 4 In Collision with object_Mouth: If Vacuum is equal to 1 Start of block Destroy the instance Set relative variable Fuel to 1 Set relative variable Fuel to 1 Set the relative score to 1 End of block
|
|
|
Logged
|
|
|
|
hpg678
|
|
Reply #7 Posted on: January 08, 2018, 08:49:46 am |
|
|
Location: Barbados Joined: Mar 2017
Posts: 283
|
Sorry it took me a while to answer. I was involved in another issue and it still isn't solved.
I had suspected you were using DRAG N DROP. So now that's settled, let's look at your problem.
First if you haven't done this already, create an object that controls the main processes of the game, (a 'controller object' so to speak,) and in its CREATE event set 'Vacuum' as a global variable.
globalvar Vacuum; Vacuum = 1;
Why give your variable vacuum a value of 1? So as it have a tangible value to start with and the switching will be 'smoother' from 1 to 0 and 0 to 1 or whatever values you give it.
=================================================
for the 'Press Q' event, I would like to erase what you have, place a 'Create Code' icon and write this code
if (Fuel < 16) && (Vacuum = 0) { Vacuum = 1; }
It's my understanding that you want to change the value of Vacuum when these two conditions are met, and this is the more direct approach.
That being the case, in the 'Release Q' event your can delete the 'If Vacuum is equal to 1' and just leave the 'Set a Variable' icon present.
=========================================================== At this time, try these changes and tell me the results.
|
|
|
Logged
|
[compromised account]
|
|
|
|
hpg678
|
|
Reply #9 Posted on: January 19, 2018, 09:22:15 am |
|
|
Location: Barbados Joined: Mar 2017
Posts: 283
|
Happy to hear of your success. As far as your other question is concerned, well.....I guess either Goombert or JOSH@Dreamland can help you on the more technical aspects; but as far as I know ENIGMA does. As far as using 'global' variables are concerned, the surest way of using them would be to to use ' globalvar < variable>' whereby any object can reference that variable from anywhere in the game. This is why I suggested using 'globalvar Vacuum' in your example game. If I understand the WIKI correctly you can also have the same effect by declaring them in the 'Globals' section of the ENIGMA subsection in the configuration tool.
|
|
|
Logged
|
[compromised account]
|
|
|
|
Josh @ Dreamland
|
|
Reply #11 Posted on: January 22, 2018, 10:40:07 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
There's no reason you should not be able to. What kind of errors?
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
Hoohee
|
|
Reply #12 Posted on: January 23, 2018, 05:24:30 pm |
|
|
Joined: Aug 2017
Posts: 40
|
I'll give the first error as an example. It's a collision event. The first D&D item is "If globalvar Vacuum is equal to 1". These sorts of events must specify what that "applies to"; I've selected Self. As global variables are not confined to any one object, possibly that's what's causing the error. At any rate, here is the error: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectdeclarations.h:1943:17: warning: inline function 'bool enigma::OBJ_object_Pollen::myevent_collision_5_subcheck()' used but never defined [enabled by default] inline bool myevent_collision_5_subcheck();
|
|
« Last Edit: January 23, 2018, 05:28:40 pm by Hoohee »
|
Logged
|
|
|
|
hpg678
|
|
Reply #13 Posted on: January 24, 2018, 10:55:08 am |
|
|
Location: Barbados Joined: Mar 2017
Posts: 283
|
Ok let's talk a little about global variables. According to Gamemaker online manual, using 'global.<variable>' and 'globalvar <variable>' have the same effect. However, experience have shown this not always to be the case. As a global variable, one would expect any object to be able to access it anywhere at anytime in the game. When you use 'global.<variable>', you need to use that prefix every time or the parser will think the variable is local and output errors. For some reason using 'globalvar <variable>' creates no confusion or errors.
to do this in Drag N Drop, you need to use a 'Add a Code' icon from the Control tab and place it in the Create event. from there you then use just the name of the '<variable>' when it asks for the name of the variable.
Now, concerning your error. It seems that you've reference a variable which wasn't declared in the object obj_Pollen. You need to check and fix it either as a local variable or a global one.
|
|
|
Logged
|
[compromised account]
|
|
|
Hoohee
|
|
Reply #14 Posted on: January 27, 2018, 06:23:52 pm |
|
|
Joined: Aug 2017
Posts: 40
|
I'm getting this error: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_globals.h:69:1: error: 'var' is not a template var<Vacuum> object_Mouth;
I wasn't sure whether "Vacuum" is supposed to be enclosed in those "greater and lesser" signs. I've tried it other ways, but all seem to return errors. Also, can an "If" statement in a block code function on its own in tandem with a Drag & Drop action, or do the condition and action have to be in the same code block? Edit: For whatever reason, I'm also getting new errors about an action I placed in one object's creation event. It is supposed to cause another object to get created at its X,Y position, but now I'm getting a message that says: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:470:26: error: reference to 'object_Mouth' is ambiguous action_create_object(object_Mouth, x, y); ^ In file included from SHELLmain.cpp:107:0: C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_globals.h:69:5: note: candidates are: var object_Mouth var object_Mouth;
That is really odd, since so far as I know, there is only one such object.
|
|
« Last Edit: January 27, 2018, 06:29:38 pm by Hoohee »
|
Logged
|
|
|
|
|