I need some GML Programming help
+3
Skaithra
SoulRed12 - Moderator
iConnor
7 posters
Page 1 of 2
Page 1 of 2 • 1, 2
I need some GML Programming help
Alright, so when I use this code for obj_player:
I get this Compilation Error:
Help me PLEASE!
I've studied my BRACKETS for like 20 minutes after each test, and I can't see it. It needs "{" this bracket somewhere?
- Code:
if (sprite_index=spr_shooterRight and keyboard_check(vk_space))
{
dist=obj_player.x - obj_zombie.x
if dist<150
{
position_destroy(x-150,y+0)
}
Else
{
//Zombie is NOT IN range
}
effect_create_above(ef_flare,x+57,y+0,1,c_yellow)
position_destroy(x+150,y+0)
sound_loop(snd_firstGun)
}
if (sprite_index=spr_shooterLeft and keyboard_check(vk_space))
{
dist=obj_player.x - obj_zombie.x
if dist<150
{
position_destroy(x+150,y+0)
}
else {
effect_create_above(ef_flare, x-57,y+0,1,c_yellow)
position_destroy(x-150,y+0)
sound_loop(snd_firstGun)
}
}
I get this Compilation Error:
- Code:
___________________________________________
FATAL ERROR in
action number 1
of Step Event
for object obj_player:
COMPILATION ERROR in code action
Error in code at line 9:
{
at position 2: Assignment operator expected.
Help me PLEASE!
I've studied my BRACKETS for like 20 minutes after each test, and I can't see it. It needs "{" this bracket somewhere?
Re: I need some GML Programming help
You have to use "else", not "Else".
That error means it expected something that isn't there, or that it didn't understand something. It's basically a general-purpose OMGWTF thing.
That error means it expected something that isn't there, or that it didn't understand something. It's basically a general-purpose OMGWTF thing.
Re: I need some GML Programming help
if (sprite_index=spr_shooterRight and keyboard_check(vk_space))
{
dist=obj_player.x - obj_zombie.x
if dist<150
{
position_destroy(x-150,y+0)
}
Else
{
//Zombie is NOT IN range
}
effect_create_above(ef_flare,x+57,y+0,1,c_yellow)
//Zombie is not in range? did you code that or did you actually write that?
Re: I need some GML Programming help
Whoops, first post was way out. Didn't even read the code properly, anyway, try putting all of your if conditions in brackets, and putting a semicollin at the end of lines (excluding ones like if and those with brackets)
Re: I need some GML Programming help
Well, it seems your code is flawed. I thought YOU should no not to break the most basic of Programming rules...
Re: I need some GML Programming help
He said it worked after editing the ELSE satement... Therefore itt is not flawed. Just a bit messy
Re: I need some GML Programming help
Wow Luke.
What kind of Admin are you?
What kind of Admin are you?
John(GmMkr-Admin)- Admin
- Number of posts : 501
Warning :
Reputation :
Registration date : 2008-07-17
Re: I need some GML Programming help
I'm a non-admin. But still, stop being 'admin-y' and help. The code now doesn't work as it's expecting a ')' or a ',' now. And it's completely fine.
Re: I need some GML Programming help
Yes, you need to put () around the if conditions, which means:
if (dist<15)
if (dist<15)
Re: I need some GML Programming help
im_not_emo wrote:Yes, you need to put () around the if conditions, which means:
if (dist<15)
Actually, in GML, you don't need parenthesis. Are you sure you didn't modify the code in any way? I took the code you posted originally, switched the else to lowercase, and ran a syntax check, which came up clean.
Re: I need some GML Programming help
yeh you don't need the brackets
where does it say the bracket is expected?
where does it say the bracket is expected?
awasteoflife- Junior Member
-
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
Reputation :
Registration date : 2008-07-25
Re: I need some GML Programming help
PEOP{LE PEOPLE PEOPLE
This is a BRACE: { }
This is a BRACKET: [ ]
These are PARENTHESES: ( )
Do we understand? You DONT use BRACKETS in GML. You do in C++ but that is beside the point.
This is a BRACE: { }
This is a BRACKET: [ ]
These are PARENTHESES: ( )
Do we understand? You DONT use BRACKETS in GML. You do in C++ but that is beside the point.
Re: I need some GML Programming help
() can also be called brackets but parentheses is the technical name
oh and we do use () parentheses in GML. to counter BIDMAS (or BODMAS)
oh and we do use () parentheses in GML. to counter BIDMAS (or BODMAS)
awasteoflife- Junior Member
-
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
Reputation :
Registration date : 2008-07-25
Re: I need some GML Programming help
Bidmas and Bodmas? What on Earth?
I guess you could say brackets ONLY when you are talking about GML, because most other programming languages use brackets AND parens
I guess you could say brackets ONLY when you are talking about GML, because most other programming languages use brackets AND parens
Re: I need some GML Programming help
BIDMAS and BODMAS are mathmatical terms, they describe the order in which an equation should be wroked out.
Brackets
Indices
Divisions
Multiplications
Additions
Subtractions
Basically, as I'm sure you know, the bits in the brackets are evaluated first. so:
5*(6+5) is not the same as 5*6+5.
So we do use brackets.
And you could also call them Braces, Curly Brackets and Square Brackets.
Brackets
Indices
Divisions
Multiplications
Additions
Subtractions
Basically, as I'm sure you know, the bits in the brackets are evaluated first. so:
5*(6+5) is not the same as 5*6+5.
So we do use brackets.
And you could also call them Braces, Curly Brackets and Square Brackets.
awasteoflife- Junior Member
-
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
Reputation :
Registration date : 2008-07-25
Re: I need some GML Programming help
OHOHOHOH... I thought BIDMA or BODMA was like a word in your native lagnauge, if any. heh, oops.
Although I know that as PEMDAS, Parentheses, Exponents, Multiply, Divide, Add, Subtract... Parentheses also includes brackets
Although I know that as PEMDAS, Parentheses, Exponents, Multiply, Divide, Add, Subtract... Parentheses also includes brackets
Re: I need some GML Programming help
Uhh.
THESE [ ] are braces
THESE { } are brackets
And THIS is off-topic.
THESE [ ] are braces
THESE { } are brackets
And THIS is off-topic.
John(GmMkr-Admin)- Admin
- Number of posts : 501
Warning :
Reputation :
Registration date : 2008-07-17
Re: I need some GML Programming help
Who cares!!? We are from different places in the world, different names for the same thing. We call it BEDMAS (Brackets Exponenets Division Multiplication Addition Subtraction). You actually do come across times in GML where you use []'s, such as in arrays ( array[2] = 0; ) etc But, in most languages it expected to use () brackets, oh, and Luke, i think you are gonna get out voted on the Parentis thing, not sure but i reckon more people call em brackets, as in most languages such as english that is what they are CALLED!
Re: I need some GML Programming help
Also Luke.
I actually have the option of banning you too.
>:^D
@C
You haven't told us if anything has changed.
I actually have the option of banning you too.
>:^D
@C
You haven't told us if anything has changed.
John(GmMkr-Admin)- Admin
- Number of posts : 501
Warning :
Reputation :
Registration date : 2008-07-17
Page 1 of 2 • 1, 2
Similar topics
» 3d programming
» Programming Beast
» OpenGL/Windows programming
» Strategy Game Programming
» Can the code of a Game Maker game be converted to another programming language ?
» Programming Beast
» OpenGL/Windows programming
» Strategy Game Programming
» Can the code of a Game Maker game be converted to another programming language ?
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|