Central Games Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

I need some GML Programming help

+3
Skaithra
SoulRed12 - Moderator
iConnor
7 posters

Page 1 of 2 1, 2  Next

Go down

I need some GML Programming help Empty I need some GML Programming help

Post by iConnor Thu Aug 21, 2008 1:09 am

Alright, so when I use this code for obj_player:

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?
iConnor
iConnor
Global Mod
Global Mod

Male
Number of posts : 366
Age : 28
Location : Oregon
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-29

http://www.diablohacking.tk

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by SoulRed12 - Moderator Thu Aug 21, 2008 2:16 am

You have to use "else", not "Else". Razz

Smile

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.
SoulRed12 - Moderator
SoulRed12 - Moderator
Admin
Admin

Male
Number of posts : 428
Age : 33
Location : USA
Job/hobbies : Music, psychology, programming, acting, basketball, and martial arts.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue100 / 100100 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-19

http://soulred12.wordpress.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Skaithra Thu Aug 21, 2008 4:07 am


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?
Skaithra
Skaithra
Elite
Elite

Male
Number of posts : 446
Age : 39
Location : From the depths
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue17 / 10017 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-24

http://alphainteractive.tk

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Thu Aug 21, 2008 4:18 am

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)

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Thu Aug 21, 2008 10:47 am

I wrote the code for him


Sorry, ELSE should NOT be in capitals
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Thu Aug 21, 2008 6:29 pm

Well, it seems your code is flawed. I thought YOU should no not to break the most basic of Programming rules...

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Thu Aug 21, 2008 10:11 pm

He said it worked after editing the ELSE satement... Therefore itt is not flawed. Just a bit messy
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Thu Aug 21, 2008 10:47 pm

lol, he shoulda pointed that out on here...

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by John(GmMkr-Admin) Thu Aug 21, 2008 10:47 pm

Wow Luke.
What kind of Admin are you?
Razz
John(GmMkr-Admin)
John(GmMkr-Admin)
Admin
Admin

Number of posts : 501
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue100 / 100100 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Thu Aug 21, 2008 10:59 pm

The kind of Admin THAT CAN BAN OTHER ADMINS
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by iConnor Thu Aug 21, 2008 11:34 pm

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.
iConnor
iConnor
Global Mod
Global Mod

Male
Number of posts : 366
Age : 28
Location : Oregon
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-29

http://www.diablohacking.tk

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Fri Aug 22, 2008 12:03 am

Yes, you need to put () around the if conditions, which means:
if (dist<15)

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Fri Aug 22, 2008 12:16 am

WOOPSY
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by SoulRed12 - Moderator Fri Aug 22, 2008 1:39 am

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.
SoulRed12 - Moderator
SoulRed12 - Moderator
Admin
Admin

Male
Number of posts : 428
Age : 33
Location : USA
Job/hobbies : Music, psychology, programming, acting, basketball, and martial arts.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue100 / 100100 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-19

http://soulred12.wordpress.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Fri Aug 22, 2008 5:12 am

For some reason, i don't trust GML so much any more...

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by awasteoflife Fri Aug 22, 2008 8:25 am

yeh you don't need the brackets

where does it say the bracket is expected?

awasteoflife
Junior Member
Junior Member

Male
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue3 / 1003 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-25

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Fri Aug 22, 2008 10:32 am

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.
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by awasteoflife Fri Aug 22, 2008 11:16 am

() can also be called brackets but parentheses is the technical name

oh and we do use () parentheses in GML. to counter BIDMAS (or BODMAS)

awasteoflife
Junior Member
Junior Member

Male
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue3 / 1003 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-25

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Fri Aug 22, 2008 11:35 am

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
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by awasteoflife Fri Aug 22, 2008 11:58 am

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.

awasteoflife
Junior Member
Junior Member

Male
Number of posts : 174
Age : 30
Location : My house
Job/hobbies : Prohramming, Gaming and Paperrounds
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue3 / 1003 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-25

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Fri Aug 22, 2008 1:01 pm

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
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by John(GmMkr-Admin) Fri Aug 22, 2008 7:50 pm

Uhh.

THESE [ ] are braces
THESE { } are brackets

Razz

And THIS is off-topic.
John(GmMkr-Admin)
John(GmMkr-Admin)
Admin
Admin

Number of posts : 501
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue100 / 100100 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Luke(ADMIN) Fri Aug 22, 2008 7:52 pm

OPPOSITE
Luke(ADMIN)
Luke(ADMIN)
Admin
Admin

Male
Number of posts : 838
Age : 30
Location : Right Behind You
Job/hobbies : Hello! I am a programmer/hacker. I play piano and French Horn. I love mountain biking and kayaking.
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

http://www.lujosoftware.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by im_not_emo Fri Aug 22, 2008 8:00 pm

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!

im_not_emo
Global Mod
Global Mod

Male
Number of posts : 896
Age : 31
Location : Auckland
Job/hobbies : Well, computer?
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue999 / 100999 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-18

http://www.inegames.f33webhost.com

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by John(GmMkr-Admin) Fri Aug 22, 2008 8:14 pm

Also Luke.
I actually have the option of banning you too.
>:^D

@C
You haven't told us if anything has changed.
John(GmMkr-Admin)
John(GmMkr-Admin)
Admin
Admin

Number of posts : 501
Warning :
I need some GML Programming help Left_bar_bleue0 / 1000 / 100I need some GML Programming help Right_bar_bleue

Reputation :
I need some GML Programming help Left_bar_bleue100 / 100100 / 100I need some GML Programming help Right_bar_bleue

Registration date : 2008-07-17

Back to top Go down

I need some GML Programming help Empty Re: I need some GML Programming help

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum