Page 1 of 1

Loading random dat files?

PostPosted: Sun Mar 23, 2014 9:44 pm
by knucklecrunchgames
Hi guys. I just wanted to know can ge load random dats. If possible, how?
You see, I want to do this because I:

First:I make 5 differents dats that have five different adverts.
Second: The loader will randomly load a different dat, making it look like it downloads different adverts.


Thanks :)

Re: Loading random dat files?

PostPosted: Sun Mar 23, 2014 11:16 pm
by CrackedP0t
Let's call the ads ad1.dat, ad2.dat, ad3.dat, ad4.dat, and ad5.dat.
When you want to load a new ad, use this code:
Code: Select all
int adno = rand(4) + 1;
char[256] adname;
sprintf(adname, "ad%i.dat", adno);
LoadGame(adname);

That should work. If you get the ads working, you should tell us how; I, for one, would be very interested to find out!

Re: Loading random dat files?

PostPosted: Mon Mar 24, 2014 8:35 pm
by knucklecrunchgames
CrackedP0t wrote:Let's call the ads ad1.dat, ad2.dat, ad3.dat, ad4.dat, and ad5.dat.
When you want to load a new ad, use this code:
Code: Select all
int adno = rand(4) + 1;
char[256] adname;
sprintf(adname, "ad%i.dat", adno);
LoadGame(adname);

That should work. If you get the ads working, you should tell us how; I, for one, would be very interested to find out!


Thanks crackedP0t :) For the ads:

1: Make advertisement pictures
2: Put em in your game
3: Add event --> Mouse button down --> Script editor -->
Code: Select all
openUrl("youradflylink");

4: When people click on your ad picture, you will earn a bit of adfly money. It's not much, but it's something in your account :)

Re: Loading random dat files?

PostPosted: Mon Mar 24, 2014 9:23 pm
by lcl
Why exactly do you ned to use multiple dat files for that kcg?
You could just have one actor with a random picture and open link depending on which animation was used. Overall, it's recommended to keep the count of separate dat files to minimum because every dat file makes your game bigger in size.

Re: Loading random dat files?

PostPosted: Mon Mar 24, 2014 9:43 pm
by knucklecrunchgames
lcl wrote:Why exactly do you ned to use multiple dat files for that kcg?
You could just have one actor with a random picture and open link depending on which animation was used. Overall, it's recommended to keep the count of separate dat files to minimum because every dat file makes your game bigger in size.


Not sure. The urls will get mixed up though.

Re: Loading random dat files?

PostPosted: Mon Mar 24, 2014 9:57 pm
by lcl
No they won't. All you need is a few if's or a switch case list.