SWF File:
Code: Select all
private static function repEx(evt:SFSEvent) : void
{
var vah:Object = null;
var extType:String = null;
var roomId:String = null;
var optionId:Number = NaN;
var pos:uint = 0;
var callCommand:uint = 0;
var option:Object = null;
var player:* = undefined;
var def:Number = NaN;
var cArDef:Array = null;
var nhj:* = undefined;
var traceBuild:* = undefined;
var cancelOrder:Boolean = false;
var auto:Boolean = false;
var unitIdStarter:Number = NaN;
var q:* = undefined;
var randTot:String = null;
var randArray:Array = null;
var vah2:Object = null;
var o:* = evt.params.dataObj;
if(o.cmd == "c")
{
swapId(o.r);
}
else if(o.cmd == "j")
{
trace("STEP J");
s = o.mj;
}
else if(o.cmd == "h2")
{
trace("STEP H2");
vah = {};
vah.userNameId = ROOT.userNameId;
fox.sendXtMessage("exRoom2","h2",vah);
}
else
{
extType = o[0];
roomId = o[1];
optionId = Number(o[2]);
pos = uint(Number(o[3]));
callCommand = uint(Number(o[4]));
option = optionData.LIST[optionId];
player = ROOT.GameKon["player" + pos];
if(callCommand == 0)
{
trace("BUILDING ORDER REC. BUILDING ID: " + o[5]);
traceBuild = gameKon.buildingArray[Number(o[5])];
cancelOrder = Boolean(Number(o[6]));
auto = Boolean(Number(o[7]));
trace("BUILD FROM: " + traceBuild + " for Player " + player + " cancel: " + cancelOrder + " auto: " + auto);
gameKon.doOption(option,cancelOrder,auto,player,traceBuild,true);
}
... (code that is being focused ^)
EXTENSION:
Code: Select all
if (cmd == "m")
{
trace("M: Event received: " + cmd)
var response = {_cmd:cmd };
var option = params.option;
var pos = params.pos;
var body = params.body;
var cmd = params.cmd;
trace("SM: Event received option: " + params.option)
trace("SM: Event received pos: " + params.pos)
trace("SM: Event received body: " + params.body)
trace("SM: Event received cmd: " + params.cmd)
response.option = option
response.pos = pos
response.body = body
response.cmd = cmd
trace ("----")
_server.sendResponse(response, fromRoom, null, [user])
trace ("SENT RESPONSE: M")
}
When M is received, the code gets the option the user is selecting, the pos stands for which user, 1, 2, 3, or 4, since there can be up to 4 per match. Body doesn't return anything at the minute, and cmd is set to 0, not sure where that comes from.
Now, I am sending this response in hoping to get these variables to make a user build something. When a user clicks something, the option, aka the building they want or unit, is sent to the option variable.
In my SWF code, I want it to build something, however, nothing seems to be happening. (Note: This isn't my code, I have taken over another project and just wish to get it in some working condition after the previous person abandoned it, as such I need a bit of guidance here with what I need to do next, or what I may be missing)