[Discussion] Helpful Scrips

E

Ethanicus

Guest
(If this isn't where this goes, I apologize.)

Hey all!

During the development of my games, I come up with a lot of scripts that help me do things faster, easier, more convenient-er, etc. Some of them are helpful enough that I always import them into new projects. For instance, one that gets percentage from two inserted values, another that changes both x and yscale at once...

So I want to know, what are some helpful scripts of your own you've come up with? Thanks!

EDIT: And as per @Aura's suggestion, maybe post your scripts under a spoiler as well.
 
Last edited:
R

RealsLife

Guest
(If this isn't where this goes, I apologize.)

Hey all!

During the development of my games, I come up with a lot of scripts that help me do things faster, easier, more convenient-er, etc. Some of them are helpful enough that I always import them into new projects. For instance, one that gets percentage from two inserted values, another that changes both x and yscale at once...

So I want to know, what are some helpful scripts of your own you've come up with? Thanks!
Well, for now I've 2scripts I know I can use in different games that are nice to use.
1)Resolution script with or without pixel perfect
2)Scrollbar system where I can put vertical or horizontal scrollbar anywhere give 4-5variables and i'm done :p!
 
E

Ethanicus

Guest
Well, for now I've 2scripts I know I can use in different games that are nice to use.
1)Resolution script with or without pixel perfect
2)Scrollbar system where I can put vertical or horizontal scrollbar anywhere give 4-5variables and i'm done :p!
Ooh, I like that second one! I'll post mine when I find where I put them. XP
 
R

RealsLife

Guest
Ooh, I like that second one! I'll post mine when I find where I put them. XP
Yeah I'm happy about it I just finished it actually :p! I will probably do some kind of tutorial on youtube for it and other systems if I've the time, also if you're still around at that moment i'll will link it and make a post in the tutorial section for it.
 
R

renex

Guest
upload_2016-9-30_21-7-7.png

- too many math and geometric helpers
- vertex buffer helpers
- encryption
- dumb tricks that are actually really unsafe like array copy
- automation (ternop, inline switch, array constructor)
- de+compression
- a collection of lerping functions
- collision optimizers
- a single script tetris for some reason
- 3d > 2d > 3d
- file format converters for really dumb formats like .ply (3d scanner)
- language and error handling systems
- several rngs and exotic distribution functions
- color operations and conversions
- complete custom (and horribly unoptimized) implementation of d3d transform from a time before transform_vertex()
- a library that does math on strings, allowing for extremely long integers
- various tokenizers and data parsers from a time before json
- json minifier
- hierarchical widget organizer for easily making complex game interfaces with only scripts
- scripts that emulate certain automatic game maker features so i can disable them and then control exactly when i want them to happen

i could probably sell a bunch of these but i'm too lazy to make them easy to use :/
 
E

Ethanicus

Guest
I'm enjoying the diversity of uses here!

Here are some of mine:
average: Put in two numbers, get the average.
draw_blurred & draw_blurred_ext: This one took forever to work out, but you give it the sprite settings, then a number, and it'll draw the sprite repeatedly with decreasing alpha to simulate blur.
draw_self_(color, alpha, scale, etc.): Draws the instance's sprite with a value changed.
fade_sound(_in): Either plays a sound with zero volume and slowly fades in, or fades out and stops, pauses or continues an already-playing sound.
in_range: Returns true if a number is within the two specified numbers.
paralax(_ext): Moves an object around in parallax style. (Yes I apparently misspelled that.)
percentage: By far my most helpful. Put in the maximum and minimum value and you get back a decimal percentage.

Aaaaand that's all.
 
R

RealsLife

Guest
View attachment 3123

- too many math and geometric helpers
- vertex buffer helpers
- encryption
- dumb tricks that are actually really unsafe like array copy
- automation (ternop, inline switch, array constructor)
- de+compression
- a collection of lerping functions
- collision optimizers
- a single script tetris for some reason
- 3d > 2d > 3d
- file format converters for really dumb formats like .ply (3d scanner)
- language and error handling systems
- several rngs and exotic distribution functions
- color operations and conversions
- complete custom (and horribly unoptimized) implementation of d3d transform from a time before transform_vertex()
- a library that does math on strings, allowing for extremely long integers
- various tokenizers and data parsers from a time before json
- json minifier
- hierarchical widget organizer for easily making complex game interfaces with only scripts
- scripts that emulate certain automatic game maker features so i can disable them and then control exactly when i want them to happen

i could probably sell a bunch of these but i'm too lazy to make them easy to use :/
color operations? I would love to find some kind of script where you've a rectangle with all colors and a seperate rectangle where you can make the colors darker/brighter I think it is called hue and saturation?
http://www.workwithcolor.com/hsl-color-picker-01.htm somthing in this style with squares would be cool :p.
 
R

renex

Guest
color operations?
- helpers for emulating d3d light and fog in 2d
- somewhat accurate ink/light mixing formulas
- hex to rgb, rgb to dec, dec to hex etc converters
- luminance-aware linear grayscale

most of those have been converted to shaders by now but I have the originals for reference.
 
A

Aura

Guest
I don't see the point of this discussion if all you have to do is share what the scripts do; nobody has shared the actual scripts yet. What is the use of doing that? ^^"

Either way, if the scripts are so useful, I'd recommend submitting them to GMLscripts as they might prove to be useful for many GM users there.
 
E

Ethanicus

Guest
I don't see the point of this discussion if all you have to do is share what the scripts do; nobody has shared the actual scripts yet. What is the use of doing that? ^^"

Either way, if the scripts are so useful, I'd recommend submitting them to GMLscripts as they might prove to be useful for many GM users there.
It's mostly out of curiosity, really. I figure if anyone wants a script someone mentions, they'll ask for it.
 

Freddy Jones

Your Main Detective
Here's a nice script I've made for anyone who wants to draw a panel, a bordered box, which smoothly scales to your desired dimensions.

Example of the order read and layout of your entered sprite (sprite scaled for easier visiblity)
Capture.PNG
Code:
///draw_panel( sprite, x, y, width, height)
/**
    Draws a panel built through a sprite broken up in a specific order.
    Useful for drawing a bordered box that easily scales to a width and height.
  
    NOTE: the outline is not placed inside of the width and height
    NOTE: the center is not tiled, but stretched, use a single colour or SVG.
  
    0: top-right-corner
    1: top-bar
    2: top-left-corner
    3: left-bar
    4: bot-left-corner
    5: bot-bar
    6: bot-right-corner
    7: right-bar
    8: center
*/

var _spr = argument0;
var _sprW = sprite_get_width( _spr );
var _sprH = sprite_get_height( _spr );
var _bl = argument1; // box left
var _bt = argument2; // box top
var _w = argument3; // width
var _h = argument4; // height
var _br = _w + _bl; // box right
var _bb = _h + _bt; // box bottom

// Draw corners (outside bounds )
/// 0 - 2 - 4 - 6
draw_sprite( _spr, 0, _br, _bt - _sprH );
draw_sprite( _spr, 2, _bl - _sprW, _bt - _sprH );
draw_sprite( _spr, 4, _bl - _sprW, _bb );
draw_sprite( _spr, 6, _br, _bb );

// Draw bars
/// 1 - 3 - 5 - 7
draw_sprite_stretched( _spr, 1, _bl, _bt - _sprH, _w, _sprH );
draw_sprite_stretched( _spr, 3, _bl - _sprW, _bt, _sprW, _h );
draw_sprite_stretched( _spr, 5, _bl, _bb, _w, _sprH );
draw_sprite_stretched( _spr, 7, _br, _bt, _sprW, _h );

// Draw center
draw_sprite_stretched( _spr, 8, _bl, _bt, _w-1, _h-1);
 
Top