ID:278050
 
Okay my Intro to Programming class at school is using Game Maker 7 now from YoYo Games. I noticed a lot of similar stuff in the programming language Game Maker uses compared to Dream Maker. However, there are substantial syntax changes. Like the switch() statement for example...

//DM syntax
switch(expression)
if(value1)
if(value2)
//...etc

//GM syntax
switch(expression);
{
case value1;
break; //The break HAS to be there in GM syntax
//...etc
}


First off, what is the point of the {} symbols? Can't the program parse/compile the programming based on lines and indentation like Dream Maker?

Secondly, those stupid semicolons on literally EVERY line is pretty annoying >_> Again kind of pointless. I see why they're used since I know what they do in DM syntax, but it's very pointless in GM syntax. Another parsing/compiling complaint >_>

Thirdly, you can't even pass TEXT ALONE to the "scripts" in GM as an argument. It HAS to be a DEFINED variable. No acceptions.

Fourthly (if that's even a word), there's the case of the use of brackets in GM compared to DM. In DM you can use brackets to reference a variable for anything it seems whereas in GM, you're very limited.

I do like Game Maker for features like easy PATH creation and the such, but I still prefer Dream Maker when it comes to simplicity in my opinion, even though Game Maker's supposedly more simple. I guess it's because I have more DM experience than GM experience :)

I'm not "flaming" Game Maker, just giving my opinion on the subject. Any other opinions would be nice.
Mizukouken Ketsu wrote:
Okay my Intro to Programming class at school is using Game Maker 7 now from YoYo Games. I noticed a lot of similar stuff in the programming language Game Maker uses compared to Dream Maker. However, there are substantial syntax changes. Like the switch() statement for example...

> //DM syntax
> switch(expression)
> if(value1)
> if(value2)
> //...etc
>
> //GM syntax
> switch(expression);
> {
> case value1;
> break; //The break HAS to be there in GM syntax
> //...etc
> }
>


First off, what is the point of the {} symbols? Can't the program parse/compile the programming based on lines and indentation like Dream Maker?

Secondly, those stupid semicolons on literally EVERY line is pretty annoying >_> Again kind of pointless. I see why they're used since I know what they do in DM syntax, but it's very pointless in GM syntax. Another parsing/compiling complaint >_>

Then you'll never survive in a large family of languages that are used in a business-programming environment.
In response to Popisfizzy (#1)
I actually adapt rather well as noted by my Intro to Networking teacher, and I'm sure my Intro to Programming teacher knows it as well... I just hate how Game Maker is so nit-picky when it comes to syntax. It's not really as flexible as I'd like it to be. I'm sure there's probably ways of doing it I haven't discovered yet. Just give me time :)

Does anyone have an noticeable experience using Game Maker at all? I'm having a little trouble with something and my teacher at school can't seem to help at all since he's new to the program as well x.x He knows JavaScript, HTML, (CSS?), and maybe some C+/C++, but definitely not GM.
In response to Mizukouken Ketsu (#2)
Mizukouken Ketsu wrote:
I just hate how Game Maker is so nit-picky when it comes to syntax. It's not really as flexible as I'd like it to be.

Most languages are nit-picky about their syntax, and the more nit-picky it is, the better. It helps keep code consistent, and makes it easier to read others' code (since it should be formatted similarly to your own).

Comparatively speaking:
// Your listed GM syntax
switch(expression);
{
case value1;
break; //The break HAS to be there in GM syntax
//...etc
}

// C++ syntax
switch(expression)
{
case value1:
break; // The break doesn't have to be there, but usually needs to be (otherwise it continues to the next case)
case value2:
break; // last case, but it's good practice to add a break here anyway
}


Incidentally, C++ (and Java, JavaScript...and most other C-based languages) requires the use of semi-colons after every statement, and C/C++ doesn't even have an internal "string" type (you can use arrays of characters, but in C++ it's generally nicer to use the string lib).

If you are looking at going anywhere with programming, get used to semi-colons and braces and nit-picky compilers---they're part of the job.
In response to Kuraudo (#3)
It's why I'm grateful DM supports C-style syntax. I've been using a lot of Python and C# lately and I'm habitually at least adding semi-colons. I can usually go without braces though.

Python actually works near-identical to how DM does, parses on newlines and tabs. It lets you use semi-colons too, but braces are for other stuff in Python. Python also doesn't require parenthesis around your conditional guts either.

PS, Python is an excellent scripting language, has more uses than I'll ever know.
I envy Game Maker and other programming languages for their power, that is, they're capable of doing more without getting bogged down. DM creates programs that run considerably slower than a lot of other software does. I also envy the ability to create standalone programs that GM seems to have.

However, when it comes to syntax, I believe DM's beautiful syntax is one of the biggest reasons why I've never been able to bring myself to learn another language. In my limited experience with other programming languages, DM has by far the cleanest and easiest to read code out there.

Great syntax is definitely one of DM's strong points.

Of course, that's assuming the programmer isn't dumb enough to cram everything into one line with semi-colons and brackets, then never use white space or comments...
1. { AND }s are not needed in Game Maker. They are optional and only really used to make it easier to read code.

2. Semi-colons are again totally optional in Game Maker.

3. You can, I have done it before, maybe you're doing something wrong?

Want proof? Make a script called passtext with the following in it...
draw_text(0,0,argument0)
In some objects draw event put the following...
passtext("hellor")
It will draw "hellor" on the screen at position 0,0 (top left corner).

4. What? You can use brackets in DM to reference any variable...? Since when?
Also, in Game Maker, it is much easier to return any variable belonging to anything than in DM, and can be done in multiple ways.
The simplest is [objectname].[objectvariable], got an object called object1 with the variable vari? Just type in object1.vari and you return the value of that variable.
All objects in GM also have unique IDs, if you know the ID you can use that inplace of the objects name.
You can store the object to a variable, for example objvari=instance_create(x,y,object1), then use objvari.vari to return that variable. (These two methods return the exact object you wants variable, the first method is less specific and will return the variable of an object that is of the type object1, but if there is more than one of those objects it will pick the first created, so you have no specific control over it).
Alternatively, you can loop through all objects that currently exist, and check if it has a variable, if so then return it.

If anything, GM has one of the worst syntaxs ever, simply because it is so loose and sloppy that it practically does not even exist. Brackets of all kinds are optional (except in functions), indentation is optional, semi-colons are optional, and most things are just optional. Example...
if var
do=something
do=somethingelse

if var
{
do=something
dosomething=somethingelse
}

if(var) {
do=someting;
dosomething=somethingelse;
}

if(var) {do=something; dosomething=somethingelse}

Those all work exactly the same in GM. One of the major problems with Game Makers language is simply how horribly sloppy it usually looks.
Mizukouken Ketsu wrote:
Okay my Intro to Programming class at school is using Game Maker 7 now from YoYo Games. I noticed a lot of similar stuff in the programming language Game Maker uses compared to Dream Maker. However, there are substantial syntax changes. Like the switch() statement for example...

> //DM syntax
> switch(expression)
> if(value1)
> if(value2)
> //...etc
>
> //GM syntax
> switch(expression);
> {
> case value1;
> break; //The break HAS to be there in GM syntax
> //...etc
> }
>


First off, what is the point of the {} symbols? Can't the program parse/compile the programming based on lines and indentation like Dream Maker?

It's easier to read. I can't stand coding in DM without them.

Secondly, those stupid semicolons on literally EVERY line is pretty annoying >_> Again kind of pointless. I see why they're used since I know what they do in DM syntax, but it's very pointless in GM syntax. Another parsing/compiling complaint >_>

AGREED.

Thirdly, you can't even pass TEXT ALONE to the "scripts" in GM as an argument. It HAS to be a DEFINED variable. No acceptions.

I'm not familiar with GM, but that sounds pretty unlikely.

Fourthly (if that's even a word), there's the case of the use of brackets in GM compared to DM. In DM you can use brackets to reference a variable for anything it seems whereas in GM, you're very limited.

Fourthly is a word. I would imagine this is possible. In PHP, you can do it like "text $stringvar text", or "text".$stringvar."text". Where the dot(.) groups two strings together. You can also use the dot to group two string variables together, and the .= to add two strings together, like this:

string .= "test" is the same as string = string + "test"

This is PHP though, I'm not familiar with GM, but it might support this as well.

I do like Game Maker for features like easy PATH creation and the such, but I still prefer Dream Maker when it comes to simplicity in my opinion, even though Game Maker's supposedly more simple. I guess it's because I have more DM experience than GM experience :)

I doubt GM is any easier than Byond.

I'm not "flaming" Game Maker, just giving my opinion on the subject. Any other opinions would be nice.
In response to The Magic Man (#6)
Since you're so GM savvy, maybe YOU can tell me what I'm doing wrong... and maybe give some suggestions on how to make it more universal...

I have this script being called by an object (in the create code of it) to follow a specific path I made for it for the first room. I have a second path for it to follow for the next room. So whenever the room changes and the obj is created, it calls the script to check which room it's in, and change the path it follows accordingly.
switch(room)
{
case "Room 1":
path_start(path_ghost_room1,4,3,true);
break;
case "Room 2":
path_start(path_ghost_room2,4,3,true);
break;
}

Now, I don't know if I'm using the wrong function for this, but it seemed like the right one. Whenever I run the game, the obj doesn't move. Which leads me to believe I did something wrong that the syntax checker can't find.

Now, I know exactly how to do this in DM... but since GM won't even tell me why it's not working, I can't seem to fix it.
In response to Mizukouken Ketsu (#8)
Rooms are not stored or referenced as strings. They are stored as unique IDs or the name of the room. If the room is called "room1", type in room1 in the code editor, and you will notice the text will become a purple colour. That means you are referencing an actual resource in the game, in this case a room.
Change "Room 1" and "Room 2" to the name of the room and that code should work.
In response to The Magic Man (#9)
In other words, I shouldn't be using spaces to name things... >_>

Now, I want to make that script universal to all ghost objs in the game. I have...

obj_ghost1
obj_ghost2
obj_ghost3
...etc

...and whatnot and I wanted to pass an argument into the script using the Execute Script command in the obj editor. But my attempts were unsuccessful...

src = "obj_[argument0]";
switch(room)
{
case room1: //btw, room1 never turned purple in the coding
src.path_start("path_[argument0]_room1",4,3,true);
break;
case room2:
src.path_start("path_[argument0]_room2",4,3,true);
break;
}

I tried this then putting src. in from of the path_start functions, but it gave me syntax errors on those, even though the variable seemed to be defined correctly. The other half of the problem was at runtime when it told me that argument0 in the command calling the script, was an undefined variable...
In response to The Magic Man (#6)
The Magic Man wrote:
4. What? You can use brackets in DM to reference any variable...? Since when?

I'm pretty sure he meant in strings, i.e. "holy [variable here]!!!!"

Also, in Game Maker, it is much easier to return any variable belonging to anything than in DM, and can be done in multiple ways.

I disagree. They can both be done with relative ease in pretty much the same way. Sure, the object needs to be instanced in DM, but I'd have it no other way. GameMaker's design calls for more use of memory because the objects don't need to be instanced. Objects in DM have unique IDs, too, and more! datum.tag is a wonderful thing.

Objects can be stored to a variable in DM, as well. In fact, if they aren't, they are cleaned automatically by the garbage collector. And in DM, you don't need to loop through anything to get one instance of an object--simply use locate().

Sorry, I just think DM makes a ton more sense here.

If anything, GM has one of the worst syntaxs ever, simply because it is so loose and sloppy that it practically does not even exist. One of the major problems with Game Makers language is simply how horribly sloppy it usually looks.

DM is somewhat similar in this aspect. You can choose to use a syntax similar to C++ or Python. I don't think it makes it sloppy at all, I think it makes it rather flexible. It allows the programmer to program in the style he chooses to. It only gets sloppy when you start mixing styles.
In response to Foomer (#5)
However, when it comes to syntax, I believe DM's beautiful syntax is one of the biggest reasons why I've never been able to bring myself to learn another language. In my limited experience with other programming languages, DM has by far the cleanest and easiest to read code out there.

Same here, the only thing is that I want to learn C++ though. My confusion with the compiler and lack of willing to learn how to use it is what demotivates me there.
In response to Kuraudo (#3)
Kuraudo babbled:
Incidentally...JavaScript...requires the use of semi-colons after every statement.

BZZ! Wrong answer! But thanks for playing!

This works just find in javascript:
    function Hello ()
{
alert("Hello World!")
}
In response to Jerico2day (#7)
Jerico2day wrote:
...In PHP, you can do it like "text $stringvar text", or "text".$stringvar."text". Where the dot(.) groups two strings together.

Close!

Replace 'groups' with 'concatenates' or 'joins'.
In response to digitalmouse (#14)
digitalmouse wrote:
Jerico2day wrote:
...In PHP, you can do it like "text $stringvar text", or "text".$stringvar."text". Where the dot(.) groups two strings together.

Close!

Replace 'groups' with 'concatenates' or 'joins'.

I dunno where my mind was there! Sorry, good catch!
In response to Mizukouken Ketsu (#10)
Wuuuut?? Game Maker isn't BYOND you know.

Firstly, if you are using a script, all variables should be defined as local to that script only using var.
var src;
Will do that.
Secondly, Game Maker does have a similar form of using [ and ] inside of a string, but it is a function. It is called execute_string.
Change "obj_[argument0]" to execute_string("obj_"+string(argument0)) to make use of it. Make similar changes with the string in path_start.
Finally, if you want something to call a function, just using object.function wont work. You have to use with.
Change src.path_start to with (src) path_start to fix that.

Doing that should fix your problems.
In response to The Magic Man (#16)
Actually if I have each ghost object's create command call the script, it will have the option to apply it to itself... So making a src var is unnecessary in that respect.

But now I have a new problem...
switch(room) //This is line 1, but that hasn't any to do with the paths yet >_>
{
case room1:
path_start(execute_string("path_"+(argument0)+"_room1"),4,3,true); //This what the error's talking about I assume
break;
}

COMPILATION ERROR in string to be executed
Error in code at line 1:
path_ghost_room1

at position 16: Variable name expected.
In response to Nadrew (#4)
Python is incredibly powerful. I've seen some great Py+GTK programs that are almost 100% Python but run smoother and faster than most other programs on the block. Then again, I wasn't using it for editing graphics. A C++ backend, Python front end normally works really well to give a program power and make it very easy to maintain.
In response to Danial.Beta (#18)
That's completely true. Boost even has a library to utilize Python in C++ (or something along those lines) which I am going to implement soon for one of my major projects.

Definitely recommending Python to anyone that wants to move outside of Byond.

George Gough
Page: 1 2