GML What's argument_relative?

E

Edmanbosch

Guest
I was editing one of my scripts when I noticed in the autocomplete that there is a variable named "argument_relative". I can't seem to find any info on it in the documentation. What does "argument_relative" do?
 
V

VectorStudio

Guest
I guess it's a boolean that checks if a script is "relative" in the DnD function.
 
V

VectorStudio

Guest
What do you mean? I don't know what "DnD function" you're talking about.
Drag and drop function. In GMS2 you can choose if you want to use GML or DnD functions when you are creating a project. In GMS1 or Game Maker X you can use both.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
What do you mean? I don't know what "DnD function" you're talking about.
It is possible to make custom libraries of Drag 'n Drop buttons (the standard ones are move, main1, main2, etc.). Each button-block type has a set of visual properties (display text, icon, contents of dialog box) and a snippet of code that it converts to. If "relative" checkbox is enabled for the action, "argument_relative" can be used to determine whether it was checked or not by the user. E.g. a "move instance" action would have code like
Code:
if (argument_relative) {
    x += argument0;
    y += argument1;
} else {
    x = argument0;
    y = argument1;
}
the global variable serves no use outside the DnD block code.
 
It is possible to make custom libraries of Drag 'n Drop buttons (the standard ones are move, main1, main2, etc.).
This is interesting - so, in theory, you could make a marketplace release where it has enhanced drag and drop functions beyond what is offered in the standard GMS?

You could design more advanced functions for people who don't want to learn code?

EDIT: I have actually seen that in old DLL's, where new user buttons were added to the GUI. I didn't realize that was what they were doing, until you just said that.
 
E

Edmanbosch

Guest
It is possible to make custom libraries of Drag 'n Drop buttons (the standard ones are move, main1, main2, etc.). Each button-block type has a set of visual properties (display text, icon, contents of dialog box) and a snippet of code that it converts to. If "relative" checkbox is enabled for the action, "argument_relative" can be used to determine whether it was checked or not by the user. E.g. a "move instance" action would have code like
Code:
if (argument_relative) {
    x += argument0;
    y += argument1;
} else {
    x = argument0;
    y = argument1;
}
the global variable serves no use outside the DnD block code.
How interesting. That's pretty cool.
It's a bit odd how there isn't much documentation for this though.
 
M

Multimagyar

Guest
Honestly I don't think it's necessary to be in it. Outside of drag and drop, and GMS1 import, scripts it's not even being used. I don't even know why yoyogames found it necessary to give it a colour or make it a "built in" variable. Or for the matter of fact why did yoyogames found it necessary to add it to the drag and drop functions instead of directly translate the drag and drop to the corresponding branch considering prior to that example code there must be something that sets the relativity to true or false.
I'm glad there are people still reading the documentation. love it when people pop up with questions that's in the documentation.
 
E

Edmanbosch

Guest
I'm glad there are people still reading the documentation. love it when people pop up with questions that's in the documentation.
If you mean that I found it in the docs, I didn't. I found it in the autocomplete. I haven't been able to find any documentation for it.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
It's a bit odd how there isn't much documentation for this though.
If I remember correctly, it's described in the documentation for "extension maker" (program for assembling libraries and legacy-format extensions). Is probably a bug that it shows up in auto-complete as such.
 
E

Edmanbosch

Guest
If I remember correctly, it's described in the documentation for "extension maker" (program for assembling libraries and legacy-format extensions). Is probably a bug that it shows up in auto-complete as such.
What do you mean by "extension maker". Do you mean the extensions resource? I can't seem to find mentions of this anywhere in the docs.
 
Last edited by a moderator:
Top