The online racing simulator
Show table
Hi!
Here's is first version of my plugin which generates table and shows it to user. It's open source, free and other thigs so you can edit it and release again but please remember to don't forget to write my nick as first creator.


<?php 
php
class table extends Plugins
{
    const 
NAME 'Table Plugin Example';
    const 
AUTHOR 'misiek08';
    const 
VERSION PHPInSimMod::VERSION;
    const 
DESCRIPTION 'Plugin to generate button table. Can be used for showing results or other info.';

    private 
$data = array(array('test''test2''test3'),array('teste''teste2''teste3'),array('tester''tester2''tester3'));
    private 
$header = array('1st''2nd''3rd');
    private 
$width 10;
    private 
$height 8;
    private 
$x 50;
    private 
$y 50;
    
    
/* Remember about this:
        define('IS_X_MIN',    0);
        define('IS_X_MAX',    110);
        define('IS_Y_MIN',    30);
        define('IS_Y_MAX',    170);
    */

    
public function __construct()
    {
        
$this->registerSayCommand('prism table''cmdTable'"Shows defined in code table for used.");
    }
    public function 
cmdTable($Msg$UCID$packet)
    {
        
$cols count($this->header);
        
$rows count($this->data);
        
$id 70;
        for(
$i 0$i $rows$i++){
            for(
$j 0$j $cols$j++){
                
$this->createButton($UCID,
                
$id,
                 ((
$j 1) * $this->width) + $this->x,
                 ((
$i 1) * $this->height) + $this->y,
                  
$this->width,
                   
$this->height,
                   
$this->data[$i][$j]);
                   
$id ++;
                   echo ((
$i 1) * $this->height) + $this->PHP_EOL;
            }
        }

        return 
PLUGIN_HANDLED;
    }
    
    private function 
createButton($ucid$id$x$y$w$h$text){
        
$btn = new IS_BTN();
        
$btn->UCID($ucid)
            ->
L($x)
            ->
T($y)
            ->
ClickID($id)
            ->
W($w)
            ->
H($h)
            ->
Text($text)
            ->
Send();
    }
}

?>

It's great and all that but as usual it stays on there forever once it's being displayed. There is no cleanup routine. Which is the basic problem of this PRISM project anyway, it's sloppy and unstable

But hey, OK, all new projects are that at this stage :P




.
You can add small function to remove button from screen and add to createButton an timer.
Quote from cargame.nl :It's great and all that but as usual it stays on there forever once it's being displayed. There is no cleanup routine. Which is the basic problem of this PRISM project anyway, it's sloppy and unstable

But hey, OK, all new projects are that at this stage :P




.

PRISM is unstable? I must admit, I've yet to hear this complaint. If your having crashes, please do submit a bug report. Some details on what was going on in the server, or better if you could submit the mpr, and then the let us know what plugins you have running with what versions so that I can try to reproduce.
#5 - PoVo
Nice plugin will use it.
Quote from Dygear :PRISM is unstable? I must admit, I've yet to hear this complaint. If your having crashes, please do submit a bug report. Some details on what was going on in the server, or better if you could submit the mpr, and then the let us know what plugins you have running with what versions so that I can try to reproduce.

I run Prism 24/7 with 4 servers, i haven't had a single crash since i used it (aside from coding errors I have made)
Quote from T3charmy :I run Prism 24/7 with 4 servers, i haven't had a single crash since i used it (aside from coding errors I have made)

That's my point, I'm quite alarmed because the only reason I left PRISM alone for so long is because all of the devs have worked very hard to make sure it's as stable as a rock. So I could trust that I could leave it and not have it crashing on peoples servers.
Quote from Dygear :That's my point, I'm quite alarmed because the only reason I left PRISM alone for so long is because all of the devs have worked very hard to make sure it's as stable as a rock. So I could trust that I could leave it and not have it crashing on peoples servers.

not sure... like i said, i haven't had a single crash that was because of prism it self... so i see no problem with it... and i have used it since 1.5 or so...
Not talking about PRISM crashing but it letting LFS clients crash because of PRISM. (LFS.exe stopped working blabla). Especially with that G-meter thing activated. But maybe because of the combination with Airio. I'm retesting right now.
Quote from cargame.nl :Not talking about PRISM crashing but it letting LFS clients crash because of PRISM. (LFS.exe stopped working blabla). Especially with that G-meter thing activated. But maybe because of the combination with Airio. I'm retesting right now.

That's interesting, but I do not think it's a PRISM bug. It sounds more like a LFS bug within the InSim system. Report it as a bug to Scawen.
Quote from Dygear :That's interesting, but I do not think it's a PRISM bug. It sounds more like a LFS bug within the InSim system. Report it as a bug to Scawen.

ahh, could it be a problem with the buttons trying to appear on the screen too fast causing the user to lag out?
Quote from T3charmy :ahh, could it be a problem with the buttons trying to appear on the screen too fast causing the user to lag out?

That would not crash the server tho, and I don't think that is what he described.
Quote from T3charmy :I think he means the users not the server :P

Heh, I did not catch on to that. Thank you. Yeah, I don't really know of any rate control problems as far as button packets, I wonder if Victor, DarkTimes, or TAA would know more about this subject then myself ... Also, I think I'm going to split these posts out of this thread as it's off topic of the OP.
I mean the clients of the LFS server yes.

Of course I can file a bug report to Scawen but at the moment that feels a bit like writing to the queen (=> pointless).

Just something to take care about, but at this moment I cannot reproduce it. I get back to you when it occurs
Quote from cargame.nl :I mean the clients of the LFS server yes.

Of course I can file a bug report to Scawen but at the moment that feels a bit like writing to the queen (=> pointless).

Just something to take care about, but at this moment I cannot reproduce it. I get back to you when it occurs

If you could reproduce it, please save the mpr and send it my way.
Why mpr?

There is no InSim data in a MPR
Because then I can reproduce what events that lead up to what happened. I can play back the MPR with a local version of PRISM running and see how many packets are going out from PRISM and how many are coming in. I can then brake it down and show how many packets are getting sent to a single user ... and so on.
Hhmm OK but lets get back on topic...

I'm glad there is someone which posts in this section but the amount of examples is still low.

I cannot advance, I have no idea how this InSim is communicating and things like

$BFN = new IS_BFN;
$BFN->SubT(1)->Send(BFN_CLEAR);

$BNF = new IS_BFN();
$BNF->SubT(BFN_DEL_BTN)->Send();

Just fail. What is SubT anyway? Really strange naming

It's frustrating, it feels like I'm 12 again
Quote from cargame.nl :
$BNF = new IS_BFN();
$BNF->SubT(BFN_DEL_BTN)->Send();

Just fail. What is SubT anyway? Really strange naming

All of this data can be found in the InSim Documentation. SubT is Sub Type.
-
(cargame.nl) DELETED by cargame.nl : wrong topic lolz
OK well.. That doesn' t really matter I'm afraid... Thats why I found out that ' thetime' isn't working but anyways;

<?php
class table extends Plugins
{
const NAME = 'Table Plugin Example';
const AUTHOR = 'misiek08';
const VERSION = PHPInSimMod::VERSION;
const DESCRIPTION = 'Plugin to generate button table. Can be used for showing results or other info.';

private $data = array(array('test', 'test2', 'test3'),array('teste', 'teste2', 'teste3'),array('tester', 'tester2', 'tester3'));
private $header = array('1st', '2nd', '3rd');
private $width = 10;
private $height = 8;
private $x = 50;
private $y = 50;

/* Remember about this:
define('IS_X_MIN', 0);
define('IS_X_MAX', 110);
define('IS_Y_MIN', 30);
define('IS_Y_MAX', 170);
*/

public function __construct()
{
$this->registerSayCommand('prism table', 'cmdTable', "Shows defined in code table for used.");
$this->registerSayCommand('prism deltable', 'deltable', 'test');
}
public function cmdTable($Msg, $UCID, $packet)
{
$cols = count($this->header);
$rows = count($this->data);
$id = 70;
for($i = 0; $i < $rows; $i++){
for($j = 0; $j < $cols; $j++){
$this->createButton($UCID,
$id,
(($j + 1) * $this->width) + $this->x,
(($i + 1) * $this->height) + $this->y,
$this->width,
$this->height,
$this->data[$i][$j]);
$id ++;
echo (($i + 1) * $this->height) + $this->y . PHP_EOL;
}
}

return PLUGIN_HANDLED;
}

private function createButton($UCID, $id, $x, $y, $w, $h, $text){
$btn = new IS_BTN();
$btn->UCID($UCID)
->L($x)
->T($y)
->ClickID($id)
->W($w)
->H($h)
->Text($text)
->Send();
}

public function deltable($UCID)
{
$MSX = new IS_MSX;
$MSX->Msg('test, '.$UCID)->Send();

$btnrem = new IS_BFN();
$btnrem->UCID($UCID)
->SubT(BFN_CLEAR)
->Send();

return PLUGIN_STOP;
}
}
?>

Still trying to find the proper way to delete buttons :678burningbananas:
Quote from Dygear :I have no idea, I'll look into it.

It works for me... only thing i changed on it was the change in time format(which was pushed into one update)

@cargame, Try this...


<?php 
php
class table extends Plugins
{
    const 
NAME 'Table Plugin Example';
    const 
AUTHOR 'misiek08';
    const 
VERSION PHPInSimMod::VERSION;
    const 
DESCRIPTION 'Plugin to generate button table. Can be used for showing results or other info.';

    private 
$data = array(array('test''test2''test3'),array('teste''teste2''teste3'),array('tester''tester2''tester3'));
    private 
$header = array('1st''2nd''3rd');
    private 
$width 10;
    private 
$height 8;
    private 
$x 50;
    private 
$y 50;

    
/* Remember about this:
        define('IS_X_MIN',    0);
        define('IS_X_MAX',    110);
        define('IS_Y_MIN',    30);
        define('IS_Y_MAX',    170);
    */

    
public function __construct()
    {
        
$this->registerSayCommand('prism table''cmdTable'"Shows defined in code table for used.");
        
$this->registerSayCommand('prism deltable''deltable''test');
    }
    public function 
cmdTable($cmd$UCID)
    {
        
$cols count($this->header);
        
$rows count($this->data);
        
$id 70;
        for(
$i 0$i $rows$i++){
            for(
$j 0$j $cols$j++){
                
$this->createButton($UCID,
                
$id,
                 ((
$j 1) * $this->width) + $this->x,
                 ((
$i 1) * $this->height) + $this->y,
                  
$this->width,
                   
$this->height,
                   
$this->data[$i][$j]);
                   
$id ++;
                   echo ((
$i 1) * $this->height) + $this->PHP_EOL;
            }
        }

        return 
PLUGIN_HANDLED;
    }

    private function 
createButton($UCID$id$x$y$w$h$text){
        
$btn = new IS_BTN();
        
$btn->UCID($UCID)
            ->
L($x)
            ->
T($y)
            ->
ClickID($id)
            ->
W($w)
            ->
H($h)
            ->
Text($text)
            ->
Send();
    }

    public function 
deltable($cmd$UCID)
    {
        
$MSX = new IS_MSX;
    
$MSX->Msg('test, '.$UCID)->Send();

        
$btnrem = new IS_BFN();
        
$btnrem->UCID($UCID)
               ->
SubT(BFN_CLEAR)
               ->
Send();

    return 
PLUGIN_STOP;
    }
}
?>

I downloaded PRISM again in a clean directory just to be sure and even tried older versions like 0.3.2 but no go

I visited two servers of you yesterday to triple check but no PRISM seemed to be running at that time.
Quote from cargame.nl :I downloaded PRISM again in a clean directory just to be sure and even tried older versions like 0.3.2 but no go

I visited two servers of you yesterday to triple check but no PRISM seemed to be running at that time.

ye, my team, is changing yet again, and the dedi has been restarting a lot(were changing the data center it is hosted at... my friend who owns the server is starting to piss me off... it is off every hour or so now... and i traced the server back, and the server was hosted at his house (facepalm) so i don't know if he went to Chicago and took his servers back or what... I just want the dang server to be on long enough so i can test everything(then again i do have PHP installed on this computer...)
Quote from cargame.nl :[Thread]

I moved that post to this thread (Show table) because that is the appropriate thread to ask that question. When we are talking about 3rd party plugins, questions should be asked to the plugin dev. That code has nothing to do with this version of PRISM or the next version. Sorry for the confusion.

[QUOTE=T3charmy;1565115]@cargame, Try this...


<?php 
public function deltable($cmd$UCID)[/QUOTE]
?>

Ah, so it was a syntax change that broke it.
1

FGED GREDG RDFGDR GSFDG