The online racing simulator
PHPInSimMod - PRISM 0.3.3 Discussion
You can download PHPInSimMod - PRISM 0.3.3 from that link. Please use this thread to talk about this release.

Thank you.

PHPInSimMod (PRISM) 0.3.3
  • Timers work correctly for both one off events and repeating events.
  • Syntax change for the createTimer function, the callback function name is to be the first argument, and the second argument is to be the interval between the timed event and it's firing.
  • The consts Plugin::TIMER_CLOSE, Plugin::TIMER_REPEAT, Plugin::TIMER_NOTRACK are gone.
  • They where replaced with Timer::CLOSE & Timer::REPEAT, there is no Timer::NOTRACK because it's not implemented here.
Thanks for the release and fixing the timers - will be upgrading to this version shortly and adjusting my timers! I will let you know if I find any bugs
Just to make this really clear, this is the function call documentation:

Description
void Timers::createTimer(callable $callback [, float $interval = 1.0 [, int $flags = Timer::CLOSE [, array $args = array() ]]] )


Parameters
callback
Name of the function you wish to execute when the timer expires.


interval
This optional parameter is the number of seconds between the timers activation and it's callback execution. Floating point numbers area allowed.


flags
This optional parameter is a constant indicating if the timer should execute again. The possible values for this parameter are the constants Timer::CLOSE, or Timer::REPEAT.


args
This optional parameter is an array of arguments or parameters you wish to send to the callback function. The first item in the array will become the first parameter, the second item in the array will become to second parameter, and so on.



As far is the other issue you posted morpha also posted this issue a while back, I wonder if he or ripnet would be willing to work on this bug.
0.3.4 is almost ready for release, except for one tiny little thing ... I broke it ... completely. PRISM will not connect to insim, and I have no idea how I managed to do that as I did not change any of that code at all.
Possibly one of those epic break it all up one character errors.. Like a missing } for example
Quote from cargame.nl :Possibly one of those epic break it all up one character errors.. Like a missing } for example

Nah, then it would fail to compile, and I'm not getting a parse error. It runs, it makes a connection, it fires the timers every x amount of time that it should, but it does not send an ISI packet anymore. However, when I chage the socket timeout to null or to a second it's fine. It's the strangest error.
So you might be wondering why I would setup an argument within the Timers::createTime function, right? What good will that do? Well consider this usage case:


<?php 
php
class welcomeTimer extends Plugins
{
    const 
NAME 'WelcomeTimer';
    const 
DESCRIPTION 'A timed welcome message to the client, using buttons.';
    const 
AUTHOR "Mark 'Dygear' Tomlin";
    const 
VERSION PHPInSimMod::VERSION;

    public function 
__construct()
    {
        
$this->registerPacket('onClientConnect'ISP_NCN);
    }

    public function 
onClientConnect($Packet)
    {
        
$UCID =& $Packet->UCID;
        
/* Make a welcome message with BTNs */
        
$this->createTimer('tmrMsgGoAway'15.0Timer::CLOSE$UCID);
    }

    public function 
tmrMsgGoAway($UCID)
    {
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
}
?>

It allows you to fire an event after another event has happened, and to do so reliably based on information we have on the client. This allows for greater flexibility and freedom for the programmer to do what they wish.

It's always been a design philosophy behind PRISM is how do you make the programmer feel like they just kicked some ass? Move everything in terms of the user's personal experience rather than the product. Keep asking, no matter what, "So, how does this help the user kick ass?" and "How does this help the user do what they really wants to do?" Don't focus on what the user will think about the product, focus everyone around you on what the user will think about themselves as a result of interacting with it.
Quote from Dygear :So you might be wondering why I would setup an argument within the Timers::createTime function, right? What good will that do? Well consider this usage case:


<?php 
php
class welcomeTimer extends Plugins
{
    const 
NAME 'WelcomeTimer';
    const 
DESCRIPTION 'A timed welcome message to the client, using buttons.';
    const 
AUTHOR "Mark 'Dygear' Tomlin";
    const 
VERSION PHPInSimMod::VERSION;

    public function 
__construct()
    {
        
$this->registerPacket('onClientConnect'ISP_NCN);
    }

    public function 
onClientConnect($Packet)
    {
        
$UCID =& $Packet->UCID;
        
/* Make a welcome message with BTNs */
        
$this->createTimer('tmrMsgGoAway'15.0Timer::CLOSE$UCID);
    }

    public function 
tmrMsgGoAway($UCID)
    {
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
}
?>


yay i needed this
Presume this would also work


<?php 
$this
->createTimer('tmrMsgGoAway'15.0Timer::CLOSE, array($UCID1));
$this->createTimer('tmrMsgGoAway'55.0Timer::CLOSE, array($UCID2));
?>

and so on?
Quote from Krammeh :Presume this would also work


<?php 
$this
->createTimer('tmrMsgGoAway'15.0Timer::CLOSE, array($UCID1);
$this->createTimer('tmrMsgGoAway'55.0Timer::CLOSE, array($UCID2);
?>

and so on?

thats what i was thinking/wondering
do it that way then just list it i would assume?


<?php 
    
public function tmrMsgGoAway($argv)
    {
        list(
$UCID$number) = $argv;
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
?>

or i guess this would work too


<?php 
    
public function tmrMsgGoAway($argv)
    {
        
$UCID $argv[1]; $number $argv[2];
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
?>

Quote from Fire_optikz001 :thats what i was thinking/wondering

I don't see why it wouldn't, it is just a variable that is being passed through
well all is well, as long as it does what we need :P
Quote from Krammeh :Presume this would also work


<?php 
$this
->createTimer('tmrMsgGoAway'15.0Timer::CLOSE, array($UCID1));
$this->createTimer('tmrMsgGoAway'55.0Timer::CLOSE, array($UCID2));
?>

and so on?

Yep!

Quote from Fire_optikz001 :thats what i was thinking/wondering
do it that way then just list it i would assume?


<?php 
    
public function tmrMsgGoAway($argv)
    {
        list(
$UCID$number) = $argv;
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
?>


No. Your syntax is wrong in this case, unless I misread how the call_user_func_array function works, the following is what you should do of the above call to createTimer.


<?php 
    
public function tmrMsgGoAway($UCID$number)
    {
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
?>

Notice that $UCID & $number are the named paramaters of the callback function. That's because it will take the array you provided in the callback function and change it so that each element of the array as a parameter to your callback function. I think it's a pretty elegant solution.
Quote from Dygear :

<?php 
    
public function tmrMsgGoAway($UCID$number)
    {
        
/* Remove all welcome BTNs from screen */
        
return PLUGIN_STOP;
    }
?>


oh ok, thanks for clarifying
Quote :unzip "PRISM 0.3.3.zip"
Archive: PRISM 0.3.3.zip
skipping: configs/admins-sample.ini need PK compat. v6.3 (can do v2.1)
skipping: configs/cvars-sample.ini need PK compat. v6.3 (can do v2.1)
skipping: configs/hosts-sample.ini need PK compat. v6.3 (can do v2.1)

Etcetc...

Will you stop using ZipX to compress this? WinRAR has no clue what to do with it either. Thanks
!prism buttons gives;
Quote :PHP NOTICE:
Object of class IS_BTN could not be converted to int in F:\php\PRIS
modules\prism_packets.php on line 135
1 :: pack in F:\php\PRISM033\modules\prism_packets.php:135
2 :: pack in F:\php\PRISM033\modules\prism_hosts.php:964
3 :: writePacket in F:\php\PRISM033\modules\prism_hosts.php:545
4 :: sendPacket in F:\php\PRISM033\modules\prism_packets.php:62
5 :: send in F:\php\PRISM033\plugins\colorButtons.php:116
7 :: call_user_func_array in F:\php\PRISM033\modules\prism_timers.p

8 :: execute in F:\php\PRISM033\modules\prism_timers.php:39
9 :: executeTimers in F:\php\PRISM033\PHPInSimMod.php:322
10 :: updateSelectTimeOut in F:\php\PRISM033\PHPInSimMod.php:217

Colored buttons also do not go away after TTL ends.
Quote from cargame.nl :Etcetc...

Will you stop using ZipX to compress this? WinRAR has no clue what to do with it either. Thanks

I'm using 7-Zip, you know the FREE and OPEN SOURCE zip utility that compresses better then WinRAR!?


Quote from cargame.nl :!prism buttons gives;

PHP NOTICE:
Object of class IS_BTN could not be converted to int in F:\php\PRIS
modules\prism_packets.php on line 135
1 :: pack in F:\php\PRISM033\modules\prism_packets.php:135
2 :: pack in F:\php\PRISM033\modules\prism_hosts.php:964
3 :: writePacket in F:\php\PRISM033\modules\prism_hosts.php:545
4 :: sendPacket in F:\php\PRISM033\modules\prism_packets.php:62
5 :: send in F:\php\PRISM033\plugins\colorButtons.php:116
7 :: call_user_func_array in F:\php\PRISM033\modules\prism_timers.p

8 :: execute in F:\php\PRISM033\modules\prism_timers.php:39
9 :: executeTimers in F:\php\PRISM033\PHPInSimMod.php:322
10 :: updateSelectTimeOut in F:\php\PRISM033\PHPInSimMod.php:217

Colored buttons also do not go away after TTL ends.

Yeah, I for got to update that plugin. Thanks for the report.

The best way to submit bug reports from now on is to post them here on github.
Quote from Dygear :I'm using 7-Zip, you know the FREE and OPEN SOURCE zip utility that compresses better then WinRAR!?

Yeah thats great and all.. But... Most people don't use it and you want interest in your work won't you?
Quote from cargame.nl :Yeah thats great and all.. But... Most people don't use it and you want interest in your work won't you?

Yeah, that's why for the last few version I was using ... Windows XP's built in Zip compression, but the files where getting up to half a meg each! I guess I'll go back to that.
@cargame.nl - really? 7-zip is compressing to normal Zip. I'm opening 7-zip zip's on clear XP's because I'm installing many systems for ppl and everything works ok. I don't have problem with ZipX and other stuff.
Yes, really.

Windows explorer does not support ZipX (also not W7 64), neither does WinRAR or the usual Linux unzip programs.

I actually didn't even knew this existed. Had to do a search why winRAR failed to decompress it correctly and thought the archive was corrupt.

Not good if you want to show work to the 'general' public.

Also 5 Kb compression profit, I do not really see the advantage of that. The software which has most compatibility and usability wins... Hence why PRISM is written in PHP

Anyway, its going slightly off topic here. If I need 7zip to decompress then it's OK with me but it's not the best choice to reach everybody.
I don't think 7zip supports zipx at all so i don't think zipx is your problem. 7zip does support a couple of different compression algorithms for .zip files so maybe you just encountered one that winrar can't handle.

Quote from cargame.nl :The software which has most compatibility and usability wins

Which is why people like 7zip.
Quote from cargame.nl :Anyway, its going slightly off topic here. If I need 7zip to decompress then it's OK with me but it's not the best choice to reach everybody.

I agree, it's important that everyone should be able to open it, not matter the platform. This is also why I went for Zip vs RAR or TZ files. Although you should have no problem downloading the zip build files from github. Just have to go to the latest commit and then click the download button that's on the right side of the screen.

Quote from filur :I don't think 7zip supports zipx at all so i don't think zipx is your problem. 7zip does support a couple of different compression algorithms for .zip files so maybe you just encountered one that winrar can't handle.

Which is why people like 7zip.

I was using LZMA for the record, it's the same compression system that makes NSIS kick so much ass.


Quote from cargame.nl :Also 5 Kb compression profit, I do not really see the advantage of that. The software which has most compatibility and usability wins... Hence why PRISM is written in PHP

Lastly, the compression profit is about 300Kb not 5Kb, unless I missed a compression option somewhere.
is there anyway to make getClientByUName case unsensitive?

also how could i get this to work if a user has a space in their name?

$data = $this->getClientByUName($argv[2]);

$argv[2] is the last variable in the cmd, so i would need to set all of the variables that are 2 to be used in getClient...
which is valid, as any case variant of a username will permit you to login to LFS (and report to the server as your case variant). Eg. dustin dawes is the same user as Dustin Dawes, however LFS will show is as "dustin dawes" (even though on LFSW it's Dustin Dawes).

FGED GREDG RDFGDR GSFDG