Citizen
02-24-2009, 02:06 PM
Our arcade system is compatible with the "ibpro" game hs format.
Note, you will need Adobe Flash software installed on your computer and the source .fla file of the game you want to make compatible.
Step 1:
Open the .fla file in Adobe Flash
Step 2:
Place this code in the first frame.
_global.ipb_get_gname = function ()
{
var _loc4 = _root._url;
var _loc5 = "";
var _loc2 = "";
var _loc6 = _loc4.lastIndexOf("\\") + 1;
if (_loc6 == -1 || _loc6 == 0)
{
_loc6 = _loc4.lastIndexOf("/") + 1;
} // end if
var _loc3 = _loc6;
var _loc7 = String(_loc4).length;
while (_loc3 < String(_loc4).length) {
_loc2 = _loc4.charAt(_loc3);
if (_loc2 == ".")
{
break;
} // end if
_loc5 = _loc5 + _loc2;
_loc3++;
} // end while
return (_loc5);
};
ipb_gname = _global.ipb_get_gname();
xx = new LoadVars();
xx.onLoad = function (success)
{
if (success)
{
_global.ipb_scoreVar = this.scoreVar;
} // end if
};
fname = "arcade/gamedata/" + ipb_gname + "/" + ipb_gname + ".txt";
xx.load(fname);
Step 3:
Create a new frame that spans the entire movie. Make a new movieclip symbol in the frame and insert this code:
if (yy.savescore == 1) {
if (ipb_score == undefined) {
ipb_score = eval (_global.ipb_scoreVar);
}
xx = new LoadVars();
xx.arcadegid = _root.ibpro_gameid;
xx.gscore = ipb_score;
xx.gname = _global.ipb_get_gname();
xx.enscore = (ipb_score * yy.randchar) ^ yy.randchar2;
xx.send("index.php?autocom=arcade&do=savescore", "_self", "POST");
stop();
}
_global.ipbSend = function (ipb_score) {
_root._visible = false;
_root.enabled = false;
xx = new LoadVars();
yy = new LoadVars();
xx.sendAndLoad("index.php?autocom=arcade&do=verifyscore", yy, "POST");
};
Step 4:
When you create your "Submit" button, add this code to it:
_global.ipbSend();
Step 5:
Create a gamedata folder in your game's main directory.
The location should be /yourgame/gamedata/
(with obvious changes to "yourgame")
Step 6:
Create a folder within the gamedata folder that has the same name as your game.
The location should be /yourgame/gamedata/yourgamename/
(with obvious changes to "yourgame" and "yourgamename")
Step 7:
Inside the new /yourgame/gamedata/yourgamename/, create the following two files:
v32game.txt
gname.txt
Step 8:
In gname.txt, add the following code:
&scoreVar=_root.punkt&blah=1Be sure to change "gname" with the "gname" of the game and "_root.score" with the acutal variable that stores the game's score.
An easier approach if the above method does not work, is to use the v2 score compatibility method....
Step 1:
Create a 'submit score' button for the game and use the following code:
on (release)
{
var gname = "SWF FILE NAME";
var gscore = _root.score;
getURL("index.php?act=Arcade&do=newscore", "_self", "POST");
}
Step 2:
If you prefer to automatically submit the score instead of using a 'submit' button, add the following code to a frame:
gscore = _root.score;
gname = "000";
getURL("index.php?act=Arcade&do=newscore", "_self", "POST");
stop();
Note, you will need Adobe Flash software installed on your computer and the source .fla file of the game you want to make compatible.
Step 1:
Open the .fla file in Adobe Flash
Step 2:
Place this code in the first frame.
_global.ipb_get_gname = function ()
{
var _loc4 = _root._url;
var _loc5 = "";
var _loc2 = "";
var _loc6 = _loc4.lastIndexOf("\\") + 1;
if (_loc6 == -1 || _loc6 == 0)
{
_loc6 = _loc4.lastIndexOf("/") + 1;
} // end if
var _loc3 = _loc6;
var _loc7 = String(_loc4).length;
while (_loc3 < String(_loc4).length) {
_loc2 = _loc4.charAt(_loc3);
if (_loc2 == ".")
{
break;
} // end if
_loc5 = _loc5 + _loc2;
_loc3++;
} // end while
return (_loc5);
};
ipb_gname = _global.ipb_get_gname();
xx = new LoadVars();
xx.onLoad = function (success)
{
if (success)
{
_global.ipb_scoreVar = this.scoreVar;
} // end if
};
fname = "arcade/gamedata/" + ipb_gname + "/" + ipb_gname + ".txt";
xx.load(fname);
Step 3:
Create a new frame that spans the entire movie. Make a new movieclip symbol in the frame and insert this code:
if (yy.savescore == 1) {
if (ipb_score == undefined) {
ipb_score = eval (_global.ipb_scoreVar);
}
xx = new LoadVars();
xx.arcadegid = _root.ibpro_gameid;
xx.gscore = ipb_score;
xx.gname = _global.ipb_get_gname();
xx.enscore = (ipb_score * yy.randchar) ^ yy.randchar2;
xx.send("index.php?autocom=arcade&do=savescore", "_self", "POST");
stop();
}
_global.ipbSend = function (ipb_score) {
_root._visible = false;
_root.enabled = false;
xx = new LoadVars();
yy = new LoadVars();
xx.sendAndLoad("index.php?autocom=arcade&do=verifyscore", yy, "POST");
};
Step 4:
When you create your "Submit" button, add this code to it:
_global.ipbSend();
Step 5:
Create a gamedata folder in your game's main directory.
The location should be /yourgame/gamedata/
(with obvious changes to "yourgame")
Step 6:
Create a folder within the gamedata folder that has the same name as your game.
The location should be /yourgame/gamedata/yourgamename/
(with obvious changes to "yourgame" and "yourgamename")
Step 7:
Inside the new /yourgame/gamedata/yourgamename/, create the following two files:
v32game.txt
gname.txt
Step 8:
In gname.txt, add the following code:
&scoreVar=_root.punkt&blah=1Be sure to change "gname" with the "gname" of the game and "_root.score" with the acutal variable that stores the game's score.
An easier approach if the above method does not work, is to use the v2 score compatibility method....
Step 1:
Create a 'submit score' button for the game and use the following code:
on (release)
{
var gname = "SWF FILE NAME";
var gscore = _root.score;
getURL("index.php?act=Arcade&do=newscore", "_self", "POST");
}
Step 2:
If you prefer to automatically submit the score instead of using a 'submit' button, add the following code to a frame:
gscore = _root.score;
gname = "000";
getURL("index.php?act=Arcade&do=newscore", "_self", "POST");
stop();