The online racing simulator
IS_UCO Circle Index
Hello everyone.

I'm trying to get circle index, but it gives me same index for every circle.

Fast testing code:
public function onINSIMCircle(IS_UCO $UCO)
{
$UCID = $this->getClientByPLID($UCO->PLID)->UCID;
IS_MTC()->Text('^3UCOAction: '. $UCO->UCOAction .' | Heading: '. $UCO->Info->Heading)->UCID($UCID)->send();

}

Like it's written in packets file:
// Identifying an InSim circle from the ObjectInfo :

// Index is 253. The circle index (seen in the autocross editor) is stored in the Heading byte.

UCOAction is changing, but Heading always is "12".
I am pretty much sure it's a bug in the packet definition


<?php 
    
const PACK 'CCCCxCxxVx8x8';
    const 
UNPACK 'CSize/CType/CReqI/CPLID/xSp0/CUCOAction/xSp2/xSp3/VTime/x8/x8';
?>

/x8/x8 looks wrong to me.

must be minimal /x8C and I think the last x8 shouldnt be there at all.

so in short;


<?php 
    
const PACK 'CCCCxCxxVx8';
    const 
UNPACK 'CSize/CType/CReqI/CPLID/xSp0/CUCOAction/xSp2/xSp3/VTime/x8C';
?>

this looks more logical to me. But I am idle with InSim LFS developing so please test out yourself what happens.
Still same problem, gives me "12".
#4 - Racon
'x8' means ignore the next 8 bytes, so the 'x8/x8' is just blanking out the CarContObj and ObjectInfo parts of the packet. (I'm guessing from the fact that you're using '$UCO->Info->Heading' instead of '$UCO->Heading' that there is further unpacking going on later in the flow, and that all the ObjectInfo data is grouped into the Info property. I'll ignore that extra unpacking and pretend the two 'sub-packets' have been ignored as it doesn't seem to be working - this is just a workaround until one of the PRISM guys fixes that extra unpacking part).

Ideally the first x8 should be replaced with something like 'CDirection/CHeading/CSpeed/CZbyte/sX/sY' to collect the CarContObj values, and the second with 'sX/sY/CZbyte/CFlags/CIndex/CHeading' to collect the ObjectInfo.

Obviously there's a clash of variable names there, so you'll need to find a way around that. I just gave my ObjectInfo variables a prefix of 'O', IIRC, so that would be:

<?php 
const UNPACK 'CSize/CType/CReqI/CPLID/xSp0/CUCOAction/xSp2/xSp3/VTime/CDirection/CHeading/CSpeed/CZbyte/sX/sY/sOX/sOY/COZbyte/COFlags/COIndex/COHeading';
?>

Then you'll just use $UCO->OHeading to get the ObjectInfo heading byte (ie, circle index), and if you need the heading from the CarContObj, that'll be $UCO->Heading.
Quote from Racon :'x8' means ignore the next 8 bytes, so the 'x8/x8' is just blanking out the CarContObj and ObjectInfo parts of the packet. (I'm guessing from the fact that you're using '$UCO->Info->Heading' instead of '$UCO->Heading' that there is further unpacking going on later in the flow, and that all the ObjectInfo data is grouped into the Info property. I'll ignore that extra unpacking and pretend the two 'sub-packets' have been ignored as it doesn't seem to be working - this is just a workaround until one of the PRISM guys fixes that extra unpacking part).

Ideally the first x8 should be replaced with something like 'CDirection/CHeading/CSpeed/CZbyte/sX/sY' to collect the CarContObj values, and the second with 'sX/sY/CZbyte/CFlags/CIndex/CHeading' to collect the ObjectInfo.

Obviously there's a clash of variable names there, so you'll need to find a way around that. I just gave my ObjectInfo variables a prefix of 'O', IIRC, so that would be:

<?php 
const UNPACK 'CSize/CType/CReqI/CPLID/xSp0/CUCOAction/xSp2/xSp3/VTime/CDirection/CHeading/CSpeed/CZbyte/sX/sY/sOX/sOY/COZbyte/COFlags/COIndex/COHeading';
?>

Then you'll just use $UCO->OHeading to get the ObjectInfo heading byte (ie, circle index), and if you need the heading from the CarContObj, that'll be $UCO->Heading.

Works great. Thanks!
If you want you can send a pull request on github and I will merge it.

FGED GREDG RDFGDR GSFDG