GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: Script Submission » sprite_export_all(dir) » 2008-02-20 17:04:21

... I can't believe I didn't think of that - I'll just make all my sprites non-transparent. You see, it is a kind of "resource center" that exports all of the sprites - they don't need to actually be used in game, and in the client program their transparency is already taken care of. This will just export them exactly how they were imported, which I trust to be correct.

This doesn't help people using more complex graphics or sprites in different situations, but it's solved for me.

#2 Re: Script Submission » sprite_export_all(dir) » 2008-02-20 10:19:02

I've had to make a change to this script. A line was changed to "draw_sprite(i,j,sprite_get_xoffset(i)+drawx,sprite_get_yoffset(i))" to account for sprites whose origin was not "0,0". Now regardless of origin or number of frames, the correct image/strip will be output.

I think it's better to just guess a draw_clear colour than to use blending if it's going to create an unintended black line around the image. What do you think?

#3 Re: Script Submission » sprite_export_all(dir) » 2008-02-19 04:29:37

I changed the script at my end to include a call to an external batch file converter. Now, the script outputs bmp strips and then converts them to .png at maximum compression (lossless so far with 256 colour format, haven't tried it with others). This script addition relies on an external .exe file. Should I include it, or perhaps just put the addition in the header as a usage example?

#4 Re: Script Submission » sprite_export_all(dir) » 2008-02-18 13:34:33

Both good points Xot. I did have surface_free in there originally, but the way I use the script is inside a project which runs and closes immediately just for the sake of exporting its resources. I've added it back in just in case people want to use it in a different way.

The blend mode code however has had some strange effects at my end - it has placed a thick black outline around each sprite and placed it on a dark green background - such a thing could actually come in handy at some point, but for now it is not the intention of the script.

Any idea what went wrong? I don't fully understand the blend mode code.

#5 Script Submission » sprite_export_all(dir) » 2008-02-18 13:09:02

Alexander_Q
Replies: 8

I made the following just now to export all sprite resources to .bmp files (subimages included in strip form).

Suggested usage: I use this server-side - the client requests a particular sprite, and the server finds it in his directory and uploads. Could be altered to export a sprite of a particular name.

Expand/*
**  Usage:
**      sprite_export_all(dir);
**
**  Arguments:
**      dir           Directory to export sprites to.
**
**  Notes:
**      Exports all sprite resources as .bmp strips to "dir"
**
**  GMLscripts.com
*/
{
    var dir,num,surfid,sprnumb;

    dir=argument0;
    num=sprite_create_from_screen(0,0,1,1,0,0,0,0,0,0);
    sprite_delete(num);
    for (i=0;i<=num;i+=1){    
        drawx=0
        if (sprite_exists(i)){
            sprnumb=sprite_get_number(i);
            surfid=surface_create(sprite_get_width(i)*sprnumb,sprite_get_height(i));
            surface_set_target(surfid);
            draw_clear(c_green);
            for (j=0;j<sprnumb;j+=1){
                draw_sprite(i,j,sprite_get_xoffset(i)+drawx,sprite_get_yoffset(i))
                drawx+=sprite_get_width(i);
            }
            surface_save(surfid, dir+sprite_get_name(i)+".bmp");
            surface_free(surfid);      
        }
    }
}

#6 Re: Community » Script PDF » 2008-02-16 03:18:54

You're right. That is quite strange... You would think that copying from a .pdf would preserve the formatting. Perhaps there is a .pdf setting which ensures the formatting information can be properly read.

#7 Re: Community » Script PDF » 2008-02-15 22:24:31

Certainly xot, here is a link to the document in question:

http://www.users.on.net/~sol/GML%20Scripts.pdf

To create it, I first downloaded the zip file you mentioned and batch converted all of the extensions to ".txt". I then used a convenient open source program called PDF Forge to combine all of the text files into a single PDF (there is an option to place one-per-page, which is quite helpful).

#8 Community » Script PDF » 2008-02-14 10:05:48

Alexander_Q
Replies: 4

I often like to just browse through the scripts, even if they provide functions I never intend to use. I have discovered many new things this way, and have come to realise more efficient ways of doing things (because all of the scripts are written in such a way as to maximise efficiency).

Thus, I thought it would be nice to combine all of the gml scripts into a single giant PDF for general skimming. The file combines 235 scripts into a 2mb file, one script per page. With Xot's permission, I'll provide a link for it in this thread.

The real shame in doing this is that although space-formatting is maintained, none of the nice syntax coloring that is part of the site's versions is recreated in the PDF. Can someone come up with a way to make a PDF via the HTML and thus produce a pdf of the scripts with coloring intact?

#9 Re: Community » Introductions » 2008-02-14 09:32:01

Hey fellas, I'm Alexander_Q, known by the same on GMC. I've been using Game Maker since November '07 (GM7, RPG Maker previously), and like all n00bs, am enthralled with the idea of creating a successful MMORRPG. Love the site Xot, has come in handy on several occasions - and not just the scripts themselves in their entirety, but as general code inspiration.

I also ride Kangaroos to work, and I must say it can become quite uncomfortable at times.

Board footer

Powered by FluxBB