GameMaker Fast scrolling through over 1000 linesof code?

K

Karlabos

Guest
So...

In early GM versions you could drag the window you were working to the left and fast scroll by dragging the scroll bar. However in GMS2 the scroll bar is on the right side and if you are on an event, the interface won't let you drag the thing to the left, instead it will resize the event window...

What I have been doing is holding ctrl and scrolling until I can see the scroll bar on the right side, scroll through until I reach the desired part of the code, and then ctrl+scroll to return to original size, but if I keep doing this, the text starts to get iffy, like in the image below: (the text is all blurry)

https://imgur.com/a/X3iDdeK

How can I scroll more effectively through big chunks of code without taking a lot of time?
 

samspade

Member
So...

In early GM versions you could drag the window you were working to the left and fast scroll by dragging the scroll bar. However in GMS2 the scroll bar is on the right side and if you are on an event, the interface won't let you drag the thing to the left, instead it will resize the event window...

What I have been doing is holding ctrl and scrolling until I can see the scroll bar on the right side, scroll through until I reach the desired part of the code, and then ctrl+scroll to return to original size, but if I keep doing this, the text starts to get iffy, like in the image below: (the text is all blurry)

https://imgur.com/a/X3iDdeK

How can I scroll more effectively through big chunks of code without taking a lot of time?
Other suggestions. Use regions and code folding. Along with keyboard shortcuts this allows you to move through code very fast.

Regions:

Code:
#region you can also add a comment in plain text here if you want

///code

#endregion
You can then click on the regions to collapse them. The following shortcuts are useful:

CTRL + M CMD + M General Fold all open regions
CTRL + U CMD + U General Unfold all regions
CTRL + Enter CMD + Enter General Toggle a region between folded/unfolded states
CTRL + Up Arrow CMD + Up Arrow General Go to the previous region
CTRL + Down Arrow CMD + Down Arrow General Go to the next region

Edit: just as another note, I looked at the picture and realized that right/left scroll bar goes really far. In general, I would try to keep it shorter. You can always hit enter in the middle of a line and the code will still work. For example:

Code:
instance_create_layer(x, 
                                     y,
                                     layer,
                                     obj);
This can also help code to be visible.

Also, 1000 lines of code is really long. Not necessarily a bad thing, but also a sign that many some of it should be broken out. Probably there is code that is being duplicated that could be put into scripts, or may a better arrangement of code in general which would make it easier to split the code up.
 
Last edited:
Top