Datablock Syncronisation? Client Access?
by Stuart Campbell · in Torque Game Engine · 06/27/2002 (1:15 am) · 2 replies
Hello again,
I am trying to script a client-side interface to the inventory system.
This appears to be an easy task, except that I have run into one crippling hurdle:
I have read that datablocks are syncronised between client and server and that the same objectid can be used to access both.
So, assumably, clientconnection.player.maxInv[*] and clientconnection.player.inv[*] information (as used by the inventory) in on the client.
My question is, how do I find my clientconnection objectid?
I tried this in a blind attempt:
function GameConnection::initialControlSet(%this)
{
echo ("*** Initial Control Object");
//Store the client object for later access:
$ClientObject = %this; // Added 27/06/02
// The first control object has been set by the server
// and we are now ready to go.
// first check if the editor is active
if (!Editor::checkActiveLoadDone())
{
if (Canvas.getContent() != PlayGui.getId())
Canvas.setContent(PlayGui);
}
}
But it has no effect when I then try:
MessageAll('TEMPMSG',Max Bullett Ammo: %1.',$ClientObject.Player.mavInv[BulletAmmo]);
Any help you can provide would be greatly appreciated.
Is my theory on this one way off? Or is it my implementation? Am I misunderstanding %this in the above callback? So many question... ;)
Regards,
Stuart
I am trying to script a client-side interface to the inventory system.
This appears to be an easy task, except that I have run into one crippling hurdle:
I have read that datablocks are syncronised between client and server and that the same objectid can be used to access both.
So, assumably, clientconnection.player.maxInv[*] and clientconnection.player.inv[*] information (as used by the inventory) in on the client.
My question is, how do I find my clientconnection objectid?
I tried this in a blind attempt:
function GameConnection::initialControlSet(%this)
{
echo ("*** Initial Control Object");
//Store the client object for later access:
$ClientObject = %this; // Added 27/06/02
// The first control object has been set by the server
// and we are now ready to go.
// first check if the editor is active
if (!Editor::checkActiveLoadDone())
{
if (Canvas.getContent() != PlayGui.getId())
Canvas.setContent(PlayGui);
}
}
But it has no effect when I then try:
MessageAll('TEMPMSG',Max Bullett Ammo: %1.',$ClientObject.Player.mavInv[BulletAmmo]);
Any help you can provide would be greatly appreciated.
Is my theory on this one way off? Or is it my implementation? Am I misunderstanding %this in the above callback? So many question... ;)
Regards,
Stuart
About the author
#2
that does the right thing, but server-side.
I need to access it client-side - after looking through many many many forum posts, it seems a lot of people are struggling w/ similar issues.
You can either add it to the engine in C++, or you can use code similar to your suggestion, but instead post the result through commandToClient()
I am going for a different tack whereby a client-side version of the inventory is maintained through message callbacks - we will see how well it works.
Thanks anyway,
Stuart
06/27/2002 (2:26 am)
Yeah,that does the right thing, but server-side.
I need to access it client-side - after looking through many many many forum posts, it seems a lot of people are struggling w/ similar issues.
You can either add it to the engine in C++, or you can use code similar to your suggestion, but instead post the result through commandToClient()
I am going for a different tack whereby a client-side version of the inventory is maintained through message callbacks - we will see how well it works.
Thanks anyway,
Stuart
Associate Stefan Beffy Moises
Sounds like that is what you need...