Jump to content


Photo

Gm Time Saver Extension 1.5 (gmtse)


  • Please log in to reply
40 replies to this topic

#1 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 12 March 2007 - 02:20 AM

Game Maker Time Saver Extension
Version 1.5
By Mark Henderson


Update: Added many new functions ingluding GML based API.

Game Maker Time Saver Extension, is an extension for Game Maker 7 that was designed to save you a lot of time when programming. GMTSE takes a large bunch of code commonly used by programmers and turns it into a new function which is one line of code! For example, instead of writing the following code:

bulletvar=instance_create(x,y,obj_bullet)
bulletvar.direction=320
bulletvar.speed=10
bulletvar.image_angle=320

You would type:

instance_create_motion("bulletvar",x,y,obj_bullet,320,10,320)

Thus saving you typing it all out and saving you time.


So far there is only 11 functions but i plan on adding as many more as possible.

The current functions are:

current_date(separator,format) This function returns the current date, the argument 'separator' is the character that will separate the day, month and year. So if you entered "/" it would return dd/mm/yyyy. Format changes the order of the day and month, 1 would return day, month and year, 2 would return month, day and year. So current_date('/',1) would return dd/mm/yyyy.

current_time_hms(separator) This function is the same as the last except it returns the hour, minute and second. Again, separator is the separator, so current_time(':') would return hour:minute:second.

directory_copy(from,to) This function is like the file_copy function except it copys folders and all files, sub-directories from one place to another. From is the directory to copy and TO is the folder to copy to.

draw_api_button(x,y,string) This draws a windows XP style button. No need for width or height as it calculates those by the string.This function will return 1 when pressed

draw_api_checkbox(x,y,checked) This function draws a checkbox for the user to click. x and y set the position on the window and checked sets wether it is checked when drawn. It will return 0 when it is not checked and 1 when it is.

draw_api_dropdown(x,y,items) THis draws a drop down box with the given items and returns the selected item. x and y set the position and items is where you put the items as a string like 'item1|item 2|item 3|item 4'. If the user selected item 1 a 0 would be returned, if they selected item 2, a 1 would be returned and so on.

draw_api_input(x,y,length,default,active) This will draw a textbox for the user to enter text. x and y set the position, length sets how long the input box is, default is the default text as a string and active sets whether the user can enter text straight away, if not it will not take keyboard input until the user clicks it. This function returns the text entered in it.

draw_api_slider(x,y,default) This function draws a sliding control. x and y set the position on the window and default is the initial value of the slider. This returns the position of the slider.

draw_grid(w,h,x,y,hn,vn,col1,col2,width) Use this to draw a grid on the window, w and h are the width and height of the squares, x and y are the position where the grid is drawn, hn and vn are the amound of horizontal and vertical squares, col1 and col2 are the colors to use and width is the width of the lines.

draw_laser(x,y,angle,length,object,step,color,alph
a)
Use this to draw a laser beam that stops when it hits other objects. x and y are where the beam comes from, angle is the angle to draw it at, length is how long the laser should be, object is the object that the laser will stop at, step is the amount the laser will grow once it is no longer hitting an object, color is the color of the beam, and alpha is the alpha of the beam.

draw_sprite_solidcolor(sprite,subimg,x,y,color) This function is like Game Makers own draw_sprite function except it draws the sprite as a solid color. Sprite is the name of the sprite to be drawn, subimg is the sub image, x and y are the positions to draw the sprite and color is the color to draw the sprite.

set_stats(lives,health,score) Instead of setting the number of lives, health and score separately at the start of a game you can use this function to do it all at once. lives is the number of lives to give, health and score have the same idea.

instance_create_motion(objectvar,x,y,object,direct
ion,speed,image_angle)
This function is a real time saver, it allows you to create an instance and set its direction, speed and image angle. objectvar is the name of the variable that will store the instance id. x and y are the positions to create the instance. Direction is the direction the instance will travel, speed is how fast it should move and image angle is what angle the image should have. This function is great for creating bullets. For example, instance_create_motion("bulletvar",0,0,obj_bullet,320,10,320)

instance_deactivate_view(viewnum,inside,notme) This function will deactivate all instances inside or outside a view depending on the number you pass. viewnum is the number of the view, so if you are using view[0] then you would pass 0 as the viewnum, if inside is set to true all instances inside the view are deactivated, if set to false then it affects the instances on the outside of the view. if notme is set to true the calling instance is not deactivated.

instance_destroy_ext(object) This function destroys a specific instance.

move_to_mouse(speed) This makes the instance move towards the mouse with the given speed, once the instance is at the mouse it stops until the mouse is moved again.

point_mouse() Call this function in a step or draw event to make the image angle point towards the mouse.

register_extension(extension,description,icon,prog
ram)
You can use this function to register a file extension with your program. extension is the file extension, for example, if you put '.sav' all files with the .sav extension will be given the following information. Description is a quick description about the file such as 'save file'. Icon is the full path to an icon file to associate with the extension, use working_directory+'images/icon.ico' finally, program is the full path to the program that will be opened when the extension is clicked.

show_stats(showlives,livescaption,showhealth,healt
hcaption,showscore,scorecaption)
This function takes the stats and draws them on the window caption. set showlives, showhealth and showscore to true or false to set whether or not to show each of them. livescaption, healthcaption and scorecaption is the text that will be shown before each stat.

sound_open(variable,fname,kind,preload,loop,volume
)
Use this to load an external sound and play it. variable is the name of the ariable as a string that will store the sounds ID. fname is the path and filename as a string. kind is what type of sound it is (look in GM help). preload sets whether or not to load the sound before it is played. loop sets whether or not to loop the file and olume is the volume to play it at (between 0 and 1)

sound_play_volume(sound,volume) Use this to play the sound at a certain volume. volume should be a number between 0 and 1. So sound_play_volume(snd_shot,0.5) would play the sound snd_**** at half volume.

website(url) Open up the users default browser with the given url.

window_set_all(visible,fullscreen,border,icons,ont
op,sizeable,caption,cursor,color,x,y,w,h)
Set all the most commonly used window_set functions all in one go.



Do you know a script or piece of code that you spend too much time typing out? Then let me add it to GMTSE and i will credit you. Just post it here, pm me or email me at mhstudios@nerdshack.com

Download from host-a.net

Edited by -!MBC!- R3D R3AP3R, 18 March 2007 - 04:11 AM.

  • 0

#2 huge stinker

huge stinker

    GMC Member

  • New Member
  • 180 posts

Posted 12 March 2007 - 02:34 AM

quite a handy set of scripts you made, 'specially the register_extension() function :)

edit: i think you accidently hit the post button twice.. there is a identical topic below this one

Edited by huge stinker, 12 March 2007 - 02:37 AM.

  • 0

#3 GuyBehindYou

GuyBehindYou

    GMC Member

  • New Member
  • 207 posts

Posted 12 March 2007 - 02:59 AM

this is a VERY good idea, but there arent any functions i use...

but i am planning on making an fps so some camera, and fps functions would be good
  • 0

#4 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 12 March 2007 - 01:56 PM

I'm glad you guys like it so far, i will be putting a lot of time into this so watch it grow :P

I don't think i have ever thought about camera functions, i would be grateful if you could point me in the direction of some examples i can use as a reference.


To be able to make this extension better i need to know what you guys want to see, it would be great if people would comment more and maybe tell me what they spend the most time coding. Maybe even a few submissions?
  • 0

#5 jemgames

jemgames

    Untrue Studios - Leader

  • New Member
  • 330 posts

Posted 14 March 2007 - 09:25 PM

Great idea. What would be really cool is if you could have a function that registers your own code to the game, so:
register_code('function name', 'code snippet')
Would return and create a new function or script or whatever with that code snippet.

Nice idea!
  • 0

#6 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 15 March 2007 - 04:45 AM

Well i dont think that would be possible. If it is then somebody will have to let me know.

The best thing to do is tell me now what you want in this and ill put it in for you, then you wouldnt need that function. I will be constantly updating this every time i get enough things to add.
  • 0

#7 SquareWheel

SquareWheel

    Square Wheel Games

  • New Member
  • 851 posts
  • Version:Unknown

Posted 15 March 2007 - 04:52 AM

Not a bad idea. I will give this a download in a bit when I got on my laptop, but from a glance it looks pretty good.
  • 0
Cook Console | Editor Engine | Mass File Namer

All of my examples are publicly available and can be found at

#8 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 15 March 2007 - 05:39 AM

Cool. I already have like 4 more things added like an instance_deactivate_ext to deactivate another instsnce from another, an sound_load to load an external sound and play it, an execute_website to open a webpage and a window_set_all to set all the window settings. If i get a couple submissions ill update to 1.5

I might even make a lib for it too lol
  • 0

#9 zephiel87

zephiel87

    GMC Member

  • New Member
  • 1649 posts

Posted 16 March 2007 - 03:00 AM

nice ideas.

i had actually thought about doing something like draw_sprite_solidcolor in my drawing extension, but hadnt gotten around to it yet. how did you do it? my plan would have been to slow, so i decided against it for now. (dont worry about me stealing your idea, i wont include it unless you really want me to... i'd just like to know how you did it and if it would be any faster.)
  • 0

#10 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 16 March 2007 - 04:28 AM

I use the d3d fog actions, i think i found a bug though. Any sprite you draw after still has the same color because i cant figure out how to turn the fog off.

Heres the code anyway:
d3d_set_fog(1,argument4,0,0);
draw_sprite(argument0,argument1,argument2,argument3)

  • 0

#11 9_6

9_6

    Guest

  • GMC Member
  • 3627 posts

Posted 16 March 2007 - 08:58 AM

Man I didn't know there is a way to draw a sprite with a solid colour!
Thank you. This will be definately useful for some projects!

And by the way, to deactivate the fog correctly, the code must be:

d3d_set_fog(1,argument4,0,0);
draw_sprite(argument0,argument1,argument2,argument3);
d3d_set_fog(0,argument4,0,0);

  • 0

#12 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 16 March 2007 - 09:24 AM

yeah, i tried that but it didnt work
  • 0

#13 9_6

9_6

    Guest

  • GMC Member
  • 3627 posts

Posted 16 March 2007 - 09:36 AM

Works for me.
So this technique doesn't seem to work flawlessly on all computers eh?
What a pitty.
  • 0

#14 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 16 March 2007 - 05:08 PM

No, i think im probably using it wrong.
  • 0

#15 zephiel87

zephiel87

    GMC Member

  • New Member
  • 1649 posts

Posted 16 March 2007 - 08:51 PM

the fog is a great idea. my method involved creating a couple of surfaces and saving the result to a new sprite. which was way too slow.
  • 0

#16 Ansgar

Ansgar

    OM Studios

  • New Member
  • 333 posts

Posted 17 March 2007 - 08:22 AM

I've already used the d3d_set_fog method and it works flawlessly for me. Just on the older of our two computers it draws only a solid square instead of the sprite. Too old graphics card or DirectX I guess...

By the way, this is a hilarious and well hidden typo :P

sound_play_volume(snd_shot,0.5) would play the sound snd_**** at half volume.

<{POST_SNAPBACK}>


  • 0

#17 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 17 March 2007 - 01:11 PM

Yeah, i cant believe i missed that typo.

I doubt its my GFX card as i have an alienware laptop with dual 512mb vga witch leaves me with 1GB of video memory. And i have DirectX 9.0c

Edited by -!MBC!- R3D R3AP3R, 17 March 2007 - 01:13 PM.

  • 0

#18 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 18 March 2007 - 04:12 AM

Updated. see first post.
  • 0

#19 pcnerd

pcnerd

    GMC Member

  • New Member
  • 197 posts

Posted 18 March 2007 - 07:03 PM

I guess my "draw windows buttons" is now pointless since it is in here. And to think the nobody even posted what they thought of it!
  • 0

#20 Jax

Jax

    GMC Member

  • New Member
  • 232 posts

Posted 18 March 2007 - 09:26 PM

it gives me this error:
___________________________________________
COMPILATION ERROR in extension package GMTimeSaverExt
Error in code at line 4:
}argument5=argument2argument2 = string_width(argument5)+12argument3 = string_height(argument5)+8

at position 2: Unexpected symbol in expression.
  • 0

#21 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 19 March 2007 - 12:47 AM

@pcnerd

Yeah, the GML API in here is about the best your going to find. Its great and its a real shame not many people are commenting.

@jax

Can you tell me what function you was using?
  • 0

#22 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 19 March 2007 - 12:52 AM

double post.

Edited by -!MBC!- R3D R3AP3R, 19 March 2007 - 12:55 AM.

  • 0

#23 Jax

Jax

    GMC Member

  • New Member
  • 232 posts

Posted 24 March 2007 - 07:43 PM

oh i was using the draw_api_button function
  • 0

#24 Chaos In a Can

Chaos In a Can

    GMC Member

  • New Member
  • 70 posts

Posted 24 March 2007 - 10:56 PM

I get the same error.
It appears to be missing spaces between the assignments.
  • 0

#25 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 25 March 2007 - 01:39 AM

Yep, I got it, too.
  • 0

#26 szepi1991

szepi1991

    GMC Member

  • New Member
  • 177 posts

Posted 29 March 2007 - 09:49 PM

me too.
  • 0

#27 mr_a

mr_a

    GMC Member

  • New Member
  • 29 posts

Posted 07 April 2007 - 07:00 AM

I can't seem to extract the .ZIP file :mellow: .
  • 0

#28 PLAY: More

PLAY: More

    Press F8 to enter BIOS

  • New Member
  • 824 posts

Posted 08 April 2007 - 02:59 AM

This is really good! One function I would like to see:
draw_sprite_default()
PRE
draw_sprite_ext(sprite_index,image_index,x,y,
image_xscale,image_yscale,image_angle,image_blend,i
mage_alpha);

EDIT: @mr_a: You may need the latest version of WinZip to extract it.

Edited by PLAY: More, 08 April 2007 - 03:03 AM.

  • 0

#29 Norrox

Norrox

    GMC Member

  • GMC Member
  • 182 posts
  • Version:GM:Studio

Posted 21 April 2007 - 04:35 PM

no one of the current functions seems to work.... lol

EDIT:

draw_api_button(x,y,"test");
COMPILATION ERROR in extension package GMTimeSaverExt
Error in code at line 4:
   }argument5=argument2argument2 = string_width(argument5)+12argument3 = string_height(argument5)+8

at position 2: Unexpected symbol in expression.

draw_api_checkbox(x,y,false);

COMPILATION ERROR in extension package GMTimeSaverExt
Error in code at line 4:
   }argument5=argument2argument2 = string_width(argument5)+12argument3 = string_height(argument5)+8

at position 2: Unexpected symbol in expression.


draw_api_dropdown(x,y,"item1|item2");

COMPILATION ERROR in extension package GMTimeSaverExt
Error in code at line 4:
   }argument5=argument2argument2 = string_width(argument5)+12argument3 = string_height(argument5)+8

at position 2: Unexpected symbol in expression.

and so on, they seem to get the same error message..

EDIT2: oh a month old topic and no fix to this ?

Edited by Norrox, 21 April 2007 - 04:45 PM.

  • 0

#30 RadicalEntertainment247

RadicalEntertainment247

    GMC Member

  • New Member
  • 58 posts

Posted 30 April 2007 - 12:41 AM

One word. Awsome. :lol:
  • 0

#31 Sandro

Sandro

    GMC Member

  • New Member
  • 184 posts

Posted 30 April 2007 - 01:06 AM

I didn't download this, but it looks like from the error messages that you didn't hit enter at two different spots

so you code should be:
argument5=argument2
argument2 = string_width(argument5)+12
argument3 = string_height(argument5)+8

NOTE: This code remove the errors but I don't know if it will make the extension work, that your job since I don't have the source.

Edited by The Shadow, 30 April 2007 - 01:11 AM.

  • 0

#32 Whisper

Whisper

    The Lesser Sound

  • New Member
  • 198 posts

Posted 07 May 2007 - 01:14 AM

it gives me this error:
___________________________________________
COMPILATION ERROR in extension package GMTimeSaverExt
Error in code at line 4:
  }argument5=argument2argument2 = string_width(argument5)+12argument3 = string_height(argument5)+8

at position 2: Unexpected symbol in expression.

<{POST_SNAPBACK}>


If that was the laser function I get the same thing.

-!MBC!- R3D R3AP3R -=- When you enter the "length" and "step" for the laser function you get that error. Is it correct in just putting a number in for those two sections? It seems like a good .GEX nonetheless! Please fix it if you can ^_^!
  • 0

#33 gamemaker_boy

gamemaker_boy

    GMC Member

  • New Member
  • 41 posts

Posted 09 May 2007 - 07:50 PM

i get the same error when i create my first extension and i found out that i need to use this sign after an variable ';'

argument5=argument2;
argument2 = string_width(argument5)+12;
argument3 = string_height(argument5)+8;

;)
  • 0

#34 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 19 May 2007 - 12:54 AM

Are yuo going to fix the errors? I want to use those functions! That's why I downloaded this extension in the first place...
  • 0

#35 DizzyTechnology

DizzyTechnology

    GMC Member

  • New Member
  • 28 posts

Posted 01 June 2007 - 08:45 PM

Would it be possible to have just a motion_set() type action? One that can set things like speed, direction, hspeed, vspeed, etc.?
  • 0

#36 -!MBC!- R3D R3AP3R

-!MBC!- R3D R3AP3R

    GMC Member

  • New Member
  • 196 posts

Posted 02 August 2007 - 01:06 PM

Sorry i havnt been here in a while, my computer blew up and had to save up for a new one. Wich means i have lost the source code for this extension, so unless someone knows how to decompile the GEX file, i think i will have to totally re-write this extension :|
  • 0

#37 teoma

teoma

    GMC Member

  • New Member
  • 113 posts

Posted 10 October 2007 - 03:49 PM

Sorry i havnt been here in a while, my computer blew up and had to save up for a new one. Wich means i have lost the source code for this extension, so unless someone knows how to decompile the GEX file, i think i will have to totally re-write this extension :|

<{POST_SNAPBACK}>


Hows that coming? I need some of those functions for a program I'm working on. Would you mind at least posting what you have done? I need the API input script, specifically. Thanks.
  • 0

#38 crems123

crems123

    GMC Member

  • New Member
  • 90 posts

Posted 18 October 2007 - 08:00 PM

hey it dont work for me i think its because of the help file esxtension. for some reason certain ones wont let me install the .gex into game maker

could you do on without a help file and the help file seperate please?

Edited by crems123, 18 October 2007 - 08:01 PM.

  • 0

#39 T11230

T11230

    GMC Member

  • New Member
  • 15 posts

Posted 27 January 2008 - 02:17 AM

Same here...
  • 0

#40 EdoI

EdoI

    GMC Member

  • New Member
  • 47 posts

Posted 24 March 2008 - 06:38 PM

I get that error too... I used draw_api_buttons.

Are you planning to fix it? If you do, PM me when its fixed.
OK people I really need windows buttons, does anybody know any extension that does that? Except this? I really need it. If you know any, reply or PM me. PLEASE
  • 0

#41 EdoI

EdoI

    GMC Member

  • New Member
  • 47 posts

Posted 29 March 2008 - 09:35 PM

I guess my "draw windows buttons" is now pointless since it is in here. And to think the nobody even posted what they thought of it!


Where can I find that draw windows buttons?? I need it. However I'll PM you either
  • 0