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

Thank you.

PHPInSimMod (PRISM) 0.5.0.0
  • Version changed to 0.5.0.0
  • Increased to INSIM_VERSION 7
  • Added all new features from 0.6M
    • New Packets (IS_JRR, IS_OCO, IS_UCO)
    • Added Zbyte to IS_OBH
    • Updated IS_SSH packet. Renamed property BMP to Name (Backwards Compatible breaking for anyone who used IS_SSH)
    • Added TINY_ALC and SMALL_ALC to get and set allowed cars (replaces /cars)
Many thanks to Povo for helping with adding the new packets

PHPInSimMod (PRISM) 0.5.0.1
  • Version changed to 0.5.0.1
  • Move betterButtonManager readme to docs folder
  • Fixes by FlameCZE
    • Added Rockingham PTH files
    • Updated docs/insim.md to version 0.6M
    • Updated IS_OCO documentation according to InSim.txt version 0.6M
PHPInSimMod (PRISM) 0.5.0.2
  • Version changed to 0.5.0.2
  • Fixes PHP 7 compatibility
  • Fixes MST, MSX, MSL, & MTC multi-line color issues mentioned in Issue #4
PHPInSimMod (PRISM) 0.5.0.3
  • Version changed to 0.5.0.3
  • Fixes TCP Connection crashes
  • Fixes the occasional crash caused when isRelay() is called when $host is equal to null
PHPInSimMod (PRISM) 0.5.0.4
  • Version changed to 0.5.0.4
  • Fixes LFS Errors when insim tries to send ISP_MTC and TINY_NCI while ISF_LOCAL is set
  • Forces ISF_REQ_JOIN query in initial setup to only accept yes or no
PHPInSimMod (PRISM) 0.5.0.5
  • Version changed to 0.5.0.5
  • Adds ability to select text/background colors when printing to console(Thanks cargame.nl/Dave)
    • Example:

      <?php 
      console
      ("this is my exampletext"true"light_green""black")
      ?>

    • To use this on Windows you will need to download and install ANSICon. To install, extract the zipped download, open command prompt, and cd to the x64 or x86 depending on your OS. and run ansicon.exe -i
    • This should work out of the box on Linux if you use /bin/bash or even /bin/sh
  • Fixes Minor issue with the translation engine
  • Fixes another issue with PHP 7 compatibility(PLC Packet Values aren't treated correctly as they were previously defined. worked fine in PHP 5.6)
PHPInSimMod (PRISM) 0.5.0.6
  • Version changed to 0.5.0.6
  • Add Missing variable to PlayerHandler so getPlayerbyUName actually works now
PHPInSimMod (PRISM) 0.5.0.7
  • Version changed to 0.5.0.7
  • Move GUI Folder into the data directory for Dygear
  • Add LANG defines to prism_packets.php (example: LANG_EN, LANG_FR, LANG_PL, LANG_DE)
  • Update translateEngine to use the defines(The previous version was technically done wrong) NOTES ON USE HERE
..
Quote from cargame.nl :Packet IS_SLC is missing UCID in the unpack

It should be;
const UNPACK = 'CSize/CType/CReqI/CUCID/a4CName';


And this is the only minor remark (not using SLC at the moment but just in case for someone who needs to). Excellent job all together.

Ah good catch! I will fix that and put out a new update

Edit: Just double checked. it appears to be there?
..
No worries. All is good! Smile

Edit: Released 0.5.0.1 with minor changes(documentation updates, and addition of Rockingham path files)
Let's go for one more bug fix today! Just pushed a commit on my repo that should fix this issue.

I want to do some testing before I merge it. if anyone wants to try these changes themselves here is what changed.
Hmm, was testing PRISM, and was having issues when connecting to a local server over a TCP connection, but worked ok over UDP, what is everyone else using?

Edit: Fixed PHP 7 compatibility issues with command callbacks

Edit 2: Version 0.5.0.2 is now available for download.

Edit 3: I think I've narrowed the crashing with TCP problem to this function in prism_hosts.php

<?php 
    
public function read(&$peerInfo)
    {
        
$this->lastReadTime time();
        return 
stream_socket_recvfrom($this->socketSTREAM_READ_BYTES0$peerInfo);
    }
?>

Edit 4: when I do

<?php 
var_dump
(fread($this->socketSTREAM_READ_BYTES));
?>

I get this as the output in the console:

string(20) " 0.6M S2 "

Edit 5: seems to be running fine if I replace the existing function with fread I will release this as another update here shortly.

Edit 6: Version 0.5.0.3 is now released, and I am now off to sleep!
T3 your my hero!
Quote from Dygear :T3 your my hero!

I try. Hopefully everything I've done today is up to par. Big grin
..
Interesting. I will take a look.
..
I believe the flag would be ISF_LOCAL, though not 100% sure. I will test later today and find out for sure.

Edit: Yep: from prism_packets.php:

<?php 
define
('ISF_LOCAL',     4);         // bit  2 : guest or single player
?>

So try adding 4 to what ever the total of your flags is in hosts.ini, and see if it still causes errors

Edit: Added checking on my github repo, will do a merge later today and release an update.
#14 - PoVo
I am always using TCP only and stream_socket_recvfrom has been working fine for years!

Running PHP 5.6
Might be an issue with PHP 7 and TCP then. Regardless my fix works in both 5.6 and 7.0
..
0.5.0.4 is out now. Fixes some issues when PRISM is ran in single player.

Edit 2/17 @ 21:50 GMT: 0.5.0.5 is released, adding ability to colorize the terminal thanks to cargame.nl. as well as fix another issue with PHP 7 compatibility & a minor change to the translation engine(how it's handled when requested text is missing from the user's language).
Reposting these notes that are updated for use in PRISM version 0.5.0.7
New version released:

Reposting these notes that have been updated for new version of PRISM

Notes:

Due to some LFS limitations, if you want to actually send any translations on connect(or in my case I had an account class that was spawned on Client Connect)
  1. on your __construct of your plugin do this

    <?php 
            $this
    ->setTranslationSettings('plugin_name'); # if your default fallback language is English(en)
            
    $this->setTranslationSettings('plugin_name'LANG_FR); # if you'd rather specify a different fallback
            # Translations will fail if this isn't ran.
    ?>

  2. Your fallback language is the language the translation engine will go to if the users language is missing.
  3. Due to some limitations of implementation in LFS, if you want to use translations, you'll need to do stuff you would normally do in NCN, in an NCI packet.

    <?php 
        
    public function onClientConnect(IS_NCI $NCI)
        {
            
    $NCN $this->getClientByUCID($NCI->UCID);
            
    #Continue on with rest of NCN packet the way you would in the IS_NCN packet
    ?>

  4. Example usage(These can not be used in NCN or any packets before the NCI connection):

    <?php 
        
    public function onPlayerJoin(IS_NPL $NPL)
        {
            
    $client $this->getClientByUCID($NPL->UCID);
            
    $this->translatePrivateMessage($NPL->UCID'User_Welcome', array($client->PName));
            
    $this->translateGlobalMessage('Global_Message'); # You can also specify an argument array here aswell
        
    }
    ?>

  5. File setup:

    ; PRISM/data/langs/plugin_name/LANG_EN.ini
    ; Might return this to the old file naming convention
    ; which was /PRISM/data/langs/plugin_name/en.ini
    Global_Message = "^7This is a global message!"
    User_Welcome = "^7Hello, %s^7!"

    ; PRISM/data/langs/plugin_name/LANG_FR.ini
    Global_Message = "^7Ce est un message global!"
    User_Welcome = "^7Bonjour, %s^7!"

..

FGED GREDG RDFGDR GSFDG