The online racing simulator
Searching in All forums
(363 results)
PHPInSimMod - PRISM 0.5.0 Discussion
T3charmy
S3 licensed
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
Last edited by T3charmy, .
PHPInSimMod (PRISM) 0.5.0
T3charmy
S3 licensed
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 example text"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
Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from PoVo :I have made a pull request for all the latest InSim changes required for patch 0.6M.

Currently using this changeset on the RC servers. Works good Smile

I'll have a look, and review it, and approve it if all works well... Also some intresting use of these new packets for cruise servers. Big grin
T3charmy
S3 licensed
I have a clean linux VM installing on my home server, gonna bring in latest code and test with PHP7 and test as well.
T3charmy
S3 licensed
@cargame, I'll have a look at cleanly/properly implementing it within the next day or so (If you don't hear anything from me by Tuesday mid-day then I probably got side-tracked).

Edit: Do we have the struct from insim.txt I could look at? what LFS version has this packet?

Edit 2: Found it: https://www.lfs.net/forum/post/1902352#post1902352
Last edited by T3charmy, .
T3charmy
S3 licensed
I assume it could potentially have to do with the way PHP now handles variables. When accessing variables in PHP classes does $class->Variable still work, or do you need to now do $class->$Variable? I haven't had a chance to do any work with PHP7 yet sadly, been busy with work, school, and general life stuff.
T3charmy
S3 licensed
The only way to acheive this is by creating a 2nd button, if you want them to visually appear as the same button, you'll need to make 3 buttons, 1 being the background, and 1 being the first line, and another being the second line. kinda like this:


<?php 
$T 
10;
$L 10;
$W 25;
$H 12;
$ButtonOne = new Button($this->UCID'btnBG''Example')->T($T)->L($L)->W($W)->H($H)->BStyle(ISB_DARK)->Send();
$ButtonTwo = new Button($this->UCID'btnText1''Example')->T($T+1)->L($L+1)->W($W)->H(5)->Text("Line 1")->Send();
$ButtonThree = new Button($this->UCID'btnText2''Example')->T($T+6)->L($L+1)->W($W)->H(5)->Text("Line 2")->Send();
?>

PRISM and PHP 7
T3charmy
S3 licensed
Was reading an article today on the new release of PHP 7. It looks like it might be a somewhat major overhaul for PRISM. I think that moving forward with this project(although I have one more planned release before I start this stuff, considering PHP 7 RC isn't even out till June) and starting to look over code, and debugging stuff to make sure it'll work on PHP 7, How ever, the big question here is backwards compatibility. Due to the fact that PHP 7 is moving to Uniform Variable Syntax, which changes how PHP interprets things like


<?php 
$obj
->$properties['name']
?>

Now this could potentially be avoided and can be made to work on both old and new versions of PHP(which might need to be done). So the main question here is, Are you planning on moving to PHP 7? Once I am able to test PRISM with php 7, I'll have an idea if anything actually needs to be recoded or if it will just work. Hopefully I will have a better idea of what needs to be done to PRISM soon.

One thing I'm kind of looking forward to, which will help greatly with the conversion to using name spacing is the new "Group Use Declarations"


<?php 
#where you will be able to do this:
use Framework\Component\{
     
SubComponent\ClassA,
     
SubComponent\ClassB as ClassC,
     
OtherComponent\ClassD
};
?>

I think overall PHP 7 is going to offer many great features that could potentially help with PRISM's future... including the improved performance.


https://blog.engineyard.com/2015/what-to-expect-php-7
https://blog.engineyard.com/2015/what-to-expect-php-7-2
T3charmy
S3 licensed
Quote from Dygear :Tend to agree, along with the old button manager starting to throw deprecation warnings to be remove in 0.5.0.

Gonna have to spend some time fixing that up since my button manager kind of uses the current one. Shouldn't be too much of an issue. I'll make that release 0.4.7.0
T3charmy
S3 licensed
I didn't think they were supposed to be case sensitive, I might need to double check the other command functions and make sure those aren't case sensitive.

Edit: @Dygear, do you think this would actually be better as 0.4.7? or just another minor version of 0.4.6?

Edit 2: Thinking of some small changes to improve the translation engine. probably gonna change it so you don't have to specify the $lang_subdirectory every time, and also be able to specify the fallback instead of having to have an extra file.

Edit 3: Went ahead and did those updates, tested them and they work well. I've updated the zip.
Last edited by T3charmy, .
T3charmy
S3 licensed
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)

Notes:
  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''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/en.ini
    Global_Message = "^7This is a global message!"
    User_Welcome = "^7Hello, %s^7!"

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

Last edited by T3charmy, .
T3charmy
S3 licensed
PHPInSimMod (PRISM) 0.4.6.4
  • Version changed to 0.4.6.4
  • Fixed Issue with IS_REO so that it now works correctly(in some cases, the old method could crash PRISM).
  • Updated Reorder plugin
  • Added a TranslationEngine(Might need some fine tuning(See notes below)
  • PHP Standards[Sweep #1] by Zenware
  • You can now send a button an array of text on creation for alternating text.
  • Commands are no longer case sensitive(Let me know if you disagree with this change)
Download Link
Last edited by T3charmy, .
T3charmy
S3 licensed
Pushed new code update which fixed issues with some packets(such as IS_REO). doing some testing, if everything still works properly, I will release a new update.

Edit: It looks like IS_REO might be the only one that uses said pack method. Gonna go ahead and get this ready for release.
Last edited by T3charmy, .
T3charmy
S3 licensed
I figured it out... I had to change the PRISM code slightly. Don't know why I didn't think of this earlier. but if you send the TINY_NCI request first, it fixes the order. therefor fixing the original issue.

Edit: And Apparently not. Although I can request it that way when insim starts, when a client connects, it still sends NCN first then NCI... need to look into this further I guess.
Last edited by T3charmy, .
T3charmy
S3 licensed
Whoops, didn't notice that typo, but it actually should have been "Send NCI packet before the NCN packet". Smile

Edit: Wait a sec, could this be fixed by me just sending the TINY_NCI before the TINY_NCN? Trying that now.
Last edited by T3charmy, .
T3charmy
S3 licensed
Dygear, I pushed 3 new code pushes to your repo(I really should start using mine to update code, not sure if it really matters...). I have gotten translations working pretty well. It could probably use some cleanup though. Not sure if there is a better way to do what I did or not.

Edit: Just did some testing(With insim half way across the world too), I'm able to send 2000 translated global messages to 3 clients(which are also half way across the world from the LFS server), in less then 5 seconds[no visual lag] only had minor CPU impact aswell, but what do you expect for sending 6000 packets.

Edit 2: Now we've hit a road block... Since the LanguageID is in the NCI packet, which comes after the NCN packet, you're unable to use any Translations in the NCN Packet(or until the NCI packet is recieved). This is really annoying -_-

Edit 3: I ended up temporarily working around the function by doing this:


<?php 
    
public function onClientConnect(IS_NCI $NCI)
    {
        
$Client $this->getClientByUCID($NCI->UCID);
        
#Continue on with rest of NCN packet using $Client instead of $NCN
        #You could probably just save yourself some time by just naming the $Client variable $NCN
?>

That way, I still have access to all the data from NCN packet in the NCI packet. While this isn't the best solution. it does work.

Edit 4: Testing an update now. I changed the order of NCI and NCN, so far it seems good, but I want to make sure it won't break anything.

Edit 5: Nope. That ran into issues. it worked great for people already on the server. but Can't get NCI to come before NCN for when a client connects after insim is started. Went back to solution in Edit 3 for now.
Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from Dygear :Perhaps we should move the GUI folder under the data directory, or config? It just hanging out there by it's self is freaking me out a little bit on the inside.

We also need a lang directory that should probably data directory, or config. Thoughts?

Hm, Either folder sounds good. maybe data might be good folders for those.

I think this file structure would be good:

PRISM/data/langs/plugin_name/(NCI->Language).ini
Last edited by T3charmy, .
T3charmy
S3 licensed
When I watch your replay I see you fine, when i watch my saved replay you don't show up... I guess that kind of makes sense.
T3charmy
S3 licensed
I think the new redesign looks good. Smile
T3charmy
S3 licensed
PHPInSimMod (PRISM) Hotfix 0.4.6.3
  • Version changed to 0.4.6.3
  • Fixed incorrect variable in welcome plugin
  • Reformat code to use spaces not tabs
  • Fix bugs, that could potentially effect some users of PRISM
  • Fully Support the NCI packet, and properly format IPs
  • Fixed slight issue with RCM command in admin.php plugin
  • Fixed the wrong variable in if statement when adding a click event to a button using betterButtonManager
  • Added 2 new objects to prism_layoutobject
Last edited by T3charmy, .
T3charmy
S3 licensed
Just curious, Since this was a originally HTML+JS, was kinda curious why you added in PHP, the stuff that was done with PHP could have easily been done with something like AngularJS(probably regular JS too)
T3charmy
S3 licensed
Quote from cargame.nl :Hmm I just downloaded a genuine 0.4.6.2 zip and run it on the server but I discovered statehandler is old in that zip. I also discovered welcome.php doesn't run at all;


PHP NOTICE:
Undefined variable: UName in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225
PHP NOTICE:
Undefined index: in /prism0462/plugins/welcome.php on line 31
1 :: onClientConnect in /prism0462/modules/prism_plugins.php:158
2 :: dispatchPacket in /prism0462/modules/prism_hosts.php:579
3 :: inspectPacket in /prism0462/modules/prism_hosts.php:487
4 :: handlePacket in /prism0462/modules/prism_hosts.php:340
5 :: checkTraffic in /prism0462/PHPInSimMod.php:225

Fatal error: Call to a member function InitButton() on a non-object in /prism0462/plugins/welcome.php on line 31

I wait a little bit longer until T3charmy has more time Wink

(In my own version NCI is running but like I said, it's doing a request every time. And I already was surprised that Scawen was insufficient with that. Thought it had something to do with backwards compatibility that there was no NCI after NCN...)

Fixed that error. Big grin I guess I'll need to make a new update soon.

My Thursdays are usually really busy, so I more then likely I'll be doing some some testing tomorrow as I am starting spring break here at work, and don't have classes on Fridays. I'm gonna be doing some thorough tests and make sure everything works right, if all goes well, I'll have a new update out by tomorrow night. Smile

Edit: I at least have PRISM starting, and running on my dedi. I have to wait till I get home to actually test if the NCI packet is working or not. Hopefully I'll be able to get NCI working with ease. I'll update this once I get home to test.

Edit 2: I just tested and NCI works fine, I did find a minor issue earlier with a missing comma in prism_statehandler.php, but it does work, haven't tested yet if it actually sets variables right or not. testing that next.

Edit 3: I also found a typo in betterButtonManager
Last edited by T3charmy, .
T3charmy
S3 licensed
Quote from Degats :
Quote from cargame.nl :NCI packet appears only when requested, as far as I know

I did some testing on my own (non-PRISM) InSim program last night.
AFAICT, NCI behaves in exactly the same way as NCN:
  • When the InSim connects, you have to send a request for a batch of them by sending a TINY (I'm actually sending mine when I've received the first VER packet)
  • When a new player joins with the InSim already connected, an NCI (ReqI 0) is received for that player after the NCN
Maybe something in PRISM isn't picking them all up properly?

Edit: Just to make sure, I just disabled sending the TINY and I still got the NCI when a client connects (just not when the InSim connects of course)

Hmm, thanks I'll have to look into it more when I get a chance.
T3charmy
S3 licensed
Quote from cargame.nl :Eehhh.. How can NCI info be @NCN now? If there is a NCN (new connection) the NCN packet is send but there doesn't automatically follows a NCI packet, only when you request it with TINY_NCI so Statehandler contains empty info for every new NCN which is there after startup of the InSim?

Right? ... I was realizing that myself yesterday and went to bed but after every NCN now needs to follow a TINY_NCI.

https://github.com/Dygear/PRISM/blob/master/modules/prism_statehandler.php#L150
https://github.com/Dygear/PRISM/blob/master/modules/prism_statehandler.php#L373
https://github.com/Dygear/PRISM/blob/master/modules/prism_statehandler.php#L439
FGED GREDG RDFGDR GSFDG