Loading random dat files?

You must understand the Game Editor concepts, before post here.

Loading random dat files?

Postby knucklecrunchgames » Sun Mar 23, 2014 9:44 pm

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 :)
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Loading random dat files?

Postby CrackedP0t » Sun Mar 23, 2014 11:16 pm

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!
/人 ◕‿‿◕ 人\
Fang Pictures, my game development company:
http://fangpictures.comuf.com
User avatar
CrackedP0t
 
Posts: 157
Joined: Mon Dec 30, 2013 5:49 pm
Location: Crested Butte, CO (The US of A)
Score: 8 Give a positive score

Re: Loading random dat files?

Postby knucklecrunchgames » Mon Mar 24, 2014 8:35 pm

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 :)
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Loading random dat files?

Postby lcl » Mon Mar 24, 2014 9:23 pm

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.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Loading random dat files?

Postby knucklecrunchgames » Mon Mar 24, 2014 9:43 pm

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.
User avatar
knucklecrunchgames
 
Posts: 1071
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 17 Give a positive score

Re: Loading random dat files?

Postby lcl » Mon Mar 24, 2014 9:57 pm

No they won't. All you need is a few if's or a switch case list.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron