GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: Script Submission » Is_Prime » 2008-02-13 03:01:39

a..... thanks
well i had a shot

any ways a nice script you have there

#2 Script Submission » 6 sprite_change_scripts » 2008-02-13 02:27:46

atarian
Replies: 3

now , just to start out with these scripts are horrendously slow around 1 SECOND per 32*32 area, now i believe that there would be a faster way using surfaces but at the moment my slow computer can't handle any surfaces of any size

Expand#define sprite_add_hue
/*sprite_add_hue(sprite,hue)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  hue : the hue to add to the sprite
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,hue,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
hue = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
for (ii = 0;ii<hie;ii+=1)
{
q = draw_getpixel(i,ii)
draw_point_color(i,ii,make_color_hsv(color_get_hue(q)+hue,color_get_saturation(q),color_get_value(q)))
}
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)
#define sprite_add_value
/*sprite_add_value(sprite,val)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  val : the value to add to the sprite
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,val,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
val = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
for (ii = 0;ii<hie;ii+=1)
{
q = draw_getpixel(i,ii)
draw_point_color(i,ii,make_color_hsv(color_get_hue(q),color_get_saturation(q),color_get_value(q)+val))
}
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)
#define sprite_add_saturation
/*sprite_add_saturation(sprite,sat)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  sat : the saturation to add to the sprite
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,sat,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
sat = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
for (ii = 0;ii<hie;ii+=1)
{
q = draw_getpixel(i,ii)
draw_point_color(i,ii,make_color_hsv(color_get_hue(q),color_get_saturation(q)+sat,color_get_value(q)))
}
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)
Expand#define sprite_set_hue
/*sprite_set_hue(sprite,hue)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  hue : the hue to set the sprite to
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,hue,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
hue = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
    for (ii = 0;ii<hie;ii+=1)
    {
        q = draw_getpixel(i,ii)
        draw_point_color(i,ii,make_color_hsv(hue,color_get_saturation(q),color_get_value(q)))
    }
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)
#define sprite_set_saturation
/*sprite_set_saturation(sprite,sat)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  sat : the saturation to set the sprite to
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,sat,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
sat = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
    for (ii = 0;ii<hie;ii+=1)
    {
        q = draw_getpixel(i,ii)
        draw_point_color(i,ii,make_color_hsv(color_get_hue(q),sat,color_get_value(q)))
    }
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)
#define sprite_set_value
/*sprite_set_value(sprite,val)
**
**     Uses :
**  To change how a sprite looks while the game is running
**
**    Arguments :
**  sprite : the sprite that is going to be edited
**  val : the value to set the sprite to
**
**   Returns :
**  The newly created sprite's index
**
**   Notes : 
**  only sprites with one subimg can be used
**  very slow
*/
var spr,val,prec,pre,q,tra,smo,xori,yori,wid,hie,e;
spr = argument0
val = argument1
prec = sprite_get_precise(spr)
pre = sprite_get_preload(spr)
tra = sprite_get_transparent(spr)
smo = sprite_get_smooth(spr)
xori = sprite_get_xoffset(spr)
yori = sprite_get_yoffset(spr)
wid = sprite_get_width(spr)
hie = sprite_get_height(spr)
e = sprite_create_from_screen(0,0,wid,hie,false,false,false,true,0,0)
draw_rectangle_color(0,0,wid,hie,32896,32896,32896,32896,false)
draw_sprite(spr,0,xori,yori)
for (i = 0;i<wid;i+=1)
{
for (ii = 0;ii<hie;ii+=1)
{
q = draw_getpixel(i,ii)
draw_point_color(i,ii,make_color_hsv(color_get_hue(q),color_get_saturation(q),val))
}
}
return sprite_create_from_screen(0,0,wid,hie,prec,tra,smo,pre,xori,yori)
draw_sprite(e,0,0,0)

there they are please tell me what you think

#3 Script Submission » Is_Prime » 2008-02-13 02:19:37

atarian
Replies: 9

Hi everyone
this is a new script of my that i made for no apparent reason.
it finds out if a number is a prime

Expand#define is_prime
/* is_prime(x)
**
** Uses: 
** for finding prime numbers
**
** Arguments:
** x            the number to check if it's a prime
**
** Returns:
** Val         true if the number is a prime false if it's not
**
*/

var _p,val;
_p = argument0
val = true
i = 2
while (val = true)&&(i!=_p-1)
{
if (frac(_p/i) = 0)
{
val = false
}
i += 1
}
return val;

can you please tell me what you tihnk

#4 Re: Script Submission » Ceaser_Cipher » 2008-02-13 02:09:23

hi i'm back, soz i've been so long well, holiday then forgot then school started but any way here the new scripts (in the top post)

#5 Re: Script Submission » Ceaser_Cipher » 2008-01-10 18:35:06

ok i've fixed all that but now it returns the text in lowercase everytime i've also made a full asci version but i can't post it yet because the computer which i'm post on dosen't have gm i will hopefully post it soon

#6 Re: Script Submission » Ceaser_Cipher » 2008-01-08 02:40:36

ok all of those ideas are done except for the 8 bit version
and i will replace the code soon, also xot i myself also made a Vigenere cipher before i check for other encryption scripts that have been made and i noticed in your example that you had made a mistake in a Vigenere cipher "a" counts as a 0 and b counts as a 1 have a look at the Vigenere cipher page on wikipedia correct me if i'm wrong

#7 Script Submission » Ceaser_Cipher » 2008-01-07 23:28:40

atarian
Replies: 6

hi everyone i'm new and due to the first topic i read i deciede to make a ceaser_cipher script so here it is




Expand #define caeser_cipher
/*caeser_cipher(text,num)
**
**  Arguments:
**  text           the text to be encrypted
**  num            the amount to move the letters by
**  
**
**  Returns:
**  Val            the encrypted text/decypt 
**
**  Notes:
**  To Decipher the text use the reverse of your enciphering number eg; 5 to cipher -5 to decipher
**  Will always return letters in lower case 
**
**  Credit:
**  To XOT for helping me comeup with ways to fix it
*/

var _str,_num,_en,_strlen,_currchar,val,_exnum;

    _str = argument0
    _num = argument1
    val = ""
    _strlen = string_length(_str)
    for (i = 1;i<=_strlen;i+=1)
    {
        _currchar = string_char_at(_str,i)
        if (ord(_currchar)+_num<=90)&&(ord(_currchar)+_num>=65)
        {
            _currchar = chr(ord(_currchar)+32)
        }
        if (ord(_currchar)+_num<=122)&&(ord(_currchar)+_num>=97)
        {  
        
            val += chr(ord(_currchar)+_num)
        }
        else
        {
            if (ord(_currchar)+_num>122)&&(ord(_currchar)+_num<=122-max(0,_num))
            {
                val+= chr(ord(_currchar)+_num-26)
            }
            else
            {
                if (ord(_currchar)+_num<97)&&(ord(_currchar)+_num>=97-min(0,_num))
                {
                    val+= chr(ord(_currchar)+_num+26)
                }
                else
                {
                    val += _currchar
                }
            }
        }
    }
    return val
Expand#define caeser_cipher_asci
/*caeser_cipher_asci(text,num)
**
**  Arguments:
**  text           the text to be encrypted
**  num            the amount to move the letters by
**  
**
**  Returns:
**  Val            the encrypted text/decypt 
**
**  Notes:
**  will return anscii encipher text so letters maybe reutned as symbols more usefull for encyption than the othe cipher
*/

var _str,_num,_en,_strlen,_currchar,val,_exnum;

    _str = argument0
    _num = argument1
    val = ""
    _strlen = string_length(_str)
    for (i = 1;i<=_strlen;i+=1)
    {
        _currchar = ord(string_char_at(_str,i))
        if (_currchar+_num>255)
        {
            _currchar-=255
        }
        if (_currchar+_num<0)
        {
            _currchar+=255
        }
            val += chr(_currchar+_num)
    }
    return val

any way here are the new scripts i think they work perfectly

edit : fixed a mistake

-atarian

#8 Re: Community » Introductions » 2008-01-07 23:21:42

Hi im Atarian my gmc name is may004 i started using gamemaker in 2005 using gm5 soon i got a hold of gm6 and registered not long after that, i started programming in 2003 using Visual Basic but i was only 11 and i was never any good at it, this year i've started helping out younger users and even started a bigish project which is at the moment on hold, i love my sport (gymnastics) and sadly im no good at any others , i like listening to most types of rock and suprisly this year have started listening to classical music (odd combination eh) i detest rap and country music though.

well thats about all i can think of at the moment

#9 Re: Script Submission » ROT13 Encryption » 2008-01-07 22:49:30

hi guys

well this is the first topic i have read and in doing so deiceded to make a ceaser_cipher i will post it soon

Board footer

Powered by FluxBB