So, I began to create my dynamic inventory today. The only problem I've come in contact with is getting the "Amount" of a variable the player has.
My issue is that %Amt returns 0.
Server Side:
$RoleplayLightOn = 0;
package Inv
{
function serverCmdLight(%client)
{
if($RoleplayLightOn == 1)
{
parent::ServerCmdLight(%client);
}
else
{
commandToClient(%client,'OpenInvMenu');
}
}
};
activatePackage(Inv);
function serverCmdGetResources(%client)
{
while(%Set < $MaxInvItems)
{
%Set += 1;
%type = $InvItem[%Set];
%amt = %client.Roleplay[%type];
commandToClient(%client,'SetRPItems',%type,%amt);
}
}
Client Side:
$InvItem[1] = "CopperOre";
$InvItem[2] = "IronOre";
$MaxInvItems = 2;
function clientCmdOpenInvMenu(%this)
{
while(%UT < $MaxInvItems)
{
%UT += 1;
%Obj = $InvItem[%UT];
echo("Object: " @ %Obj);
%Amt = serverCmdGetResource(%Obj);
echo("Amount: " @ %type);
if(%type > 0)
{
InvTextList.addRow(%UT, %obj TAB %amt);
}
}
canvas.pushDialog(Medieval_Inventory);
}