GameMaker Code Regions

Status
Not open for further replies.
For those of you who don't know you can do an amazing thing to clean up your code and it's this

#region
//This is some code I want to fold...
#endregion


Now if you didn't understand that, basically instead of typing out // every time you want to make a header of a section just do #region infront of that text and at the end of each section of programming just do
#endregion.

Here are two pictures:

What it looks like all stored up in a nice bundle:
Screenshot_4.png

What it looks like when you press that plus button:
Screenshot_5.png

I hope you enjoy :)
 

Attachments

L

Lonewolff

Guest
Yep, will be buried in six hours.

Not that there is anything new that isn't covered in the manual here.
 
L

Lonewolff

Guest
Fair enough. But this is one of those cases where what is a huge discovery to one, is common knowledge to most others.
 

rIKmAN

Member
Not everyone reads the entire Manuel so finding this is cool.
If people read the manual, they find out how to use the IDE and what it can do - including code folding.
That's literally what the manual is for, after all.

Hopefully this can be the trigger for you to read through the manual and find some other cool features you've missed in the last couple of years.
Snippets might just blow your mind!
 
L

Lonewolff

Guest
@rIKmAN - Agreed 10000%.

The manual is cram packed with mind blowing snippets of information. There is a reason @Nocturne has put so much effort into it. One of those reasons is that people might actually read it and become better with GameMaker because of it. (Funny that)
 
D

Danei

Guest
My code has always seemed to randomly unfold itself when I close the event or script and reopen it, so I stopped trying to use regions a while back. Is that still going on, or is that just me, or is it something they fixed?
 

rIKmAN

Member
My code has always seemed to randomly unfold itself when I close the event or script and reopen it, so I stopped trying to use regions a while back. Is that still going on, or is that just me, or is it something they fixed?
They still unfold if you close the object/script and reopen it.

This is something I'd never actually noticed before though as I generally don't close objects/scripts very often and use the Resource Tree / CTRL+T to be auto-navigated around the workspace.

Maybe file that as a suggestion?
 
D

Danei

Guest
I basically do the same thing (except I need to remember to use Ctrl-T more). Unfortunately as my pc is fairly craptastic, having tons of stuff open at once in a workspace seems to slow the IDE's performance, so I periodically clear it all. I tend to just separate code with empty space and/or commented-out lines of glyphs, but probably if I ever get a new PC i'll make more use of the inbuilt folding.
 

rIKmAN

Member
I basically do the same thing (except I need to remember to use Ctrl-T more). Unfortunately as my pc is fairly craptastic, having tons of stuff open at once in a workspace seems to slow the IDE's performance, so I periodically clear it all. I tend to just separate code with empty space and/or commented-out lines of glyphs, but probably if I ever get a new PC i'll make more use of the inbuilt folding.
Yeah I can see how that would be pretty annoying if you are closing things regularly and having your regions unfold each time.

I'd still file that as a suggestion / bug report, it doesn't seem unreasonable to have your regions stay closed the way you left them.
Maybe have a look at GMEdit by YellowAfterlife to see if that has that feature too, might be useful until you get an updated PC.
 

Bentley

Member
Snippets might just blow your mind!
I know OP's post will get deleted b/c it belongs in tutorials, but I'll ask just in case you get this: by snippets do you mean code snippets, specifically custom code snippets?

If so, would you mind showing me a custom code snippet you regularly use? It would be really helpful.
 
I know OP's post will get deleted b/c it belongs in tutorials, but I'll ask just in case you get this: by snippets do you mean code snippets, specifically custom code snippets?

If so, would you mind showing me a custom code snippet you regularly use? It would be really helpful.
WELL MY POST IN TUTORIALS GOT DELETED SO IDFK WHAT"S GOING ON!!!! What is a snippet?
 

rIKmAN

Member
WELL MY POST IN TUTORIALS GOT DELETED SO IDFK WHAT"S GOING ON!!!!
No need to swear in acronyms and post in all caps, it seems like every post you make breaks one of the Community Guidelines - you should read them.
What is a snippet?
Why don’t you put some effort in, go and find snippets in the manual, then come back and tell us?

@Bentley I have the JSDoc header on a snippet, as well as some tile collision code which gets used a lot as my current games uses multiple tile layers for various things for example.
Quite a few are specific to my current project and others more generic.

If you want actual code from the snippets file I won’t be back at my PC until tomorrow evening.
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
WELL MY POST IN TUTORIALS GOT DELETED SO IDFK WHAT"S GOING ON!!!! What is a snippet?
If your post was deleted then you'd have been sent a personal message by the moderator that removed it explaining exactly what is going on. ;)

I'm also going to close this topic as it really serves little purpose. The manual contains the information it shows, and there isn't any discussion value to it either given how it's been written. I'd also suggest to the OP that they give the forum rules a read before posting again.
 
Status
Not open for further replies.
Top