Page 1 of 1

Custom Function Pack - - Request yours

PostPosted: Thu Jun 04, 2009 10:41 pm
by Hblade
Custom Function Pack Request a function and I will see what I can do.
Functions available in this pack:
    Playtime
    FillColorCanvas
    SmoothMovement
    ChangeColor
    Visible
    SaveFile
    LoadFile
View the Read me file for instructions and how to use.
Code: Select all
//                FUNCTIONS - Craig Ramsey//
//         Welcome to the list of functions                     View the readme file
//         I made using Game Editor, these                      for information on how
//         functions are easy to use, enjoy.                    to use these functions.



                               // Defines
#define true 1
#define false 0
                               // INT variables
int framecount;
int temp;
int i;
int seconds;
int minutes;
int hours;
int fps = 30;   //Set your framerate here.
                                //Char variables
char *key=GetKeyState();
void Playtime()
{
    framecount = framecount + 1;
    if (framecount == fps * 3)
    {
        framecount = 0;
        seconds = seconds + 1;
    }
    if (seconds == 60)
    {
        minutes = minutes + 1;
        seconds = 0;
    }
    if (minutes == 60)
    {
        minutes == 0;
        hours = hours + 1;
    }
}
void FillColorCanvas(int r, int g, int b, int transparency)
{
    erase(r, g, b, transparency);
}
void SmoothMovement(int distancex, int distancey, int speed)
{
    MoveTo("Event Actor", distancex, distancey, speed, "Event Actor", "");
}
void ChangeColor(int rh, int gh, int bh)
{
    r = rh;
    g = gh;
    b = bh;
}
void Visible(int ifvisible)
{
    if (ifvisible == 0)
    {
        transp = 1;
    }
    if (ifvisible == 1)
    {
        transp = 0;
    }
}
void SaveFile(char * filename, char str[255])
{

  FILE*file;
   file = fopen(filename, "w+b");

  fwrite(str, sizeof(file), 1, file);

  fclose(file);
}
void LoadFile(char * name, char * store)
{
    FILE*file;

   file = fopen(name, "r+b");
    fread(&store, sizeof(store), 1, file);

   fclose(file);
}

Re: Custom Function Pack - - Request yours

PostPosted: Fri Jun 05, 2009 3:17 pm
by Fojam
that is awesome!
can you make a function that lets you do something, wait an amount of time, and then do another thing without having to use a timer?

Re: Custom Function Pack - - Request yours

PostPosted: Fri Jun 05, 2009 3:39 pm
by Hblade
I already have that, :D In my sig, just click "My custom functions", you'll see it there.

Re: Custom Function Pack - - Request yours

PostPosted: Fri Jun 05, 2009 11:14 pm
by factorman2
can you make a simple save function? :D I'd really appreciate it.

Re: Custom Function Pack - - Request yours

PostPosted: Sun Jun 07, 2009 7:15 pm
by Hblade
It would be hard to make an advanced save function, but I will try.