The online racing simulator
Is_reo
(14 posts, started )
Is_reo
I have array like this:

<?php 
$grid 
= array('misiek08' => 2'Dygear' => 1'm1s1ek' => 3);
?>

Can you show me how with PRISM send this as grid on the race start?
Quote from misiek08 :I have array like this:

<?php 
$grid 
= array('misiek08' => 2'Dygear' => 1'm1s1ek' => 3);
?>

Can you show me how with PRISM send this as grid on the race start?

Are those values their UCIDs PLIDs?
No, sir. Positions on start, so they are not sorted out. I wonna get PLID's by username's but in PRISM IS_REO packet is wiritten as "a32" array not "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
Quote from misiek08 :No, sir. Positions on start, so they are not sorted out. I wonna get PLID's by username's but in PRISM IS_REO packet is wiritten as "a32" array not "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"

There is a reason I did that, but I can't for the life of me remember what that was. I'm sure it will come to me when I use the system. Ok, so you also need to get PLIDs as well, all you have right now is a list of Usernames and you don't even know for sure if they are connected or not.
Just to follow up, there is no really clean way to do this, so I guess I'll push the 0.3.1 update tomorrow with a bunch of fixes to make this possible and clean.

(That's right kids, you heard it here first, 0.3.1 is coming out tomorrow.)
Ok, so let's take that array:

<?php 
$grid 
= array(3,4,9,21,5,12);
?>

That are PLID's sorted as grid. PLID 3 - 1st pos on start and so on.....
How to send it to server properly?

EDIT:
I didn't send REO before.
In PHPLFS I getted REO few times but always as CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.
Someone was talking me about receiving and sending as array but I don't know how.
It should be C32, not a32 ... Or I guess you could use the ord function, but that's kinda lame.
Could you make an plugin for that? For example register say command 'set grid', wchich restarts race and sets grid.
Quote from misiek08 :Could you make an plugin for that? For example register say command 'set grid', wchich restarts race and sets grid.

Yeah, that's exactly what I'll do.
When it will be done, developer?

Maybe it can help:

<?php 
class IS_REO extends ISP {
    public 
$Size 36;
    public 
$Type ISP_REO;
    public 
$ReqI// 0 unless this is a reply to an TINY_REO request
    
public $NumP;        // number of players in race

    
public $PLID = array();    // all PLIDs in new order
    
    
protected $up_format 'CSize/CType/CReqI/CNumP/CP0/CP1/CP2/CP3/CP4/CP5/CP6/CP7/CP8/CP9/CP10/CP11/CP12/CP13/CP14/CP15/CP16/CP17/CP18/CP19/CP20/CP21/CP22/CP23/CP24/CP25/CP26/CP27/CP28/CP29/CP30/CP31';
    protected 
$p_format 'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC';

    public function 
unpack($data)
    {
        
$up unpack($this->up_format$data);
        
$this->Size $up['Size'];
        
$this->ReqI $up['ReqI'];
        
$this->NumP $up['NumP'];
        
$i 0;
        for(
$i 0$i 32; ++$i)
        {
            
$this->PLID[$i] = $up['P' $i];
        }
    }

    public function 
pack()
    {
        return 
pack($this->p_format$this->Size$this->Type$this->ReqI$this->NumP$this->PLID[0], $this->PLID[1], $this->PLID[2], $this->PLID[3], $this->PLID[4], $this->PLID[5], $this->PLID[6], $this->PLID[7], $this->PLID[8], $this->PLID[9], $this->PLID[10], $this->PLID[11], $this->PLID[12], $this->PLID[13], $this->PLID[14], $this->PLID[15], $this->PLID[16], $this->PLID[17], $this->PLID[18], $this->PLID[19], $this->PLID[20], $this->PLID[21], $this->PLID[22], $this->PLID[23], $this->PLID[24], $this->PLID[25], $this->PLID[26], $this->PLID[27], $this->PLID[28], $this->PLID[29], $this->PLID[30], $this->PLID[31]);
    }
}
?>

It's not finished but only first step to make it working in my PHPLFS edition.

EDIT:

Someone already did it:
http://www.lfsforum.net/showthread.php?p=1485152#post1485152

Maybe attach it to public release.
I've edited it:

<?php 
class IS_REO extends struct // REOrder (when race restarts after qualifying)
{
    const 
PACK 'CCCCC32';
    const 
UNPACK 'CSize/CType/CReqI/CNumP/C32PLID';

    public 
$Size 36;        // 36
    
public $Type ISP_REO;// ISP_REO
    
public $ReqI;            // 0 unless this is a reply to an TINY_REO request
    
public $NumP;            // number of players in race

    
public $PLID = array();        // all PLIDs in new order

    
function unpack($rawPacket)
    {
        
$pkClass unpack($this::UNPACK$rawPacket);

        for (
$pos 1$pos <= 32; ++$pos)
        {
            
$pkClass['PLID'][$pos] = $pkClass["PLID{$pos}"];
            unset(
$pkClass["PLID{$pos}"]);
        }

        foreach (
$pkClass as $property => $value)
        {
            
$this->$property $value;
        }

        return 
$this;
    }
};
?>

And working plugin (get's the REO):

<?php 
php
class test extends Plugins
{
    const 
NAME 'Test';
    const 
AUTHOR 'Misiek';
    const 
VERSION PHPInSimMod::VERSION;
    const 
DESCRIPTION 'Testing PRISM.';

    public function 
__construct()
    {
        
$this->registerPacket('print_rr',ISP_REO);
    }

    public function 
print_rr($packet){
        foreach(
$packet->PLID as $pos => $plid){
            echo 
'Pos:'$pos' / PLID:'$plid' / Nick: ', (($plid != 0) ? $this->getClientByPLID($plid)->UName ''), PHP_EOL;
        }
    }
}
?>

Now the packing part and it will work!

EDIT:
I'll use for now edited pack and parsePackFormat functions from GeForz. I think, it should be added to main PRISM release.
Quote from Dygear :
(That's right kids, you heard it here first, 0.3.1 is coming out tomorrow.)

What tomorrow exactly?
Quote from cargame.nl :What tomorrow exactly?

27-23 = 4.

I know that people like post sometimes kb and kB as the same thing. I think 01.11 will be date for the 0.3.1 release.
Quote from misiek08 :27-23 = 4.

I know that people like post sometimes kb and kB as the same thing. I think 01.11 will be date for the 0.3.1 release.

Lol, yeah, I tripped over some things. It should be out ... Soon ...

Is_reo
(14 posts, started )
FGED GREDG RDFGDR GSFDG