The online racing simulator
#1 - Racon
PHP7/Win - PIE (PHP; InSim; Easy) - Windows EXE running a PHP InSim framework
PiranMOTO PIE (PHP; InSim; Easy) - Windows EXE running a PHP InSim framework

** Please consider this a beta release at this time! **

PIE is designed to be give easy access to InSim functionality with the PHP programming language (ver 7.2, CLI mode). It takes care of connection to InSim (and optionally OutSim and OutGauge) and maintaining the connection, and calls a user-defined function on receipt of any packet. It can be used to connect to an LFS client (local mode) or an LFS server (host mode) and comes with some basic commands and debugging.

PIE is a commandline executable that reads a PHP file (refered to as a PIE script) and optionally a text configuration file. PIE then uses the settings provided to initiate a connection to InSim. Once connected, PIE will wake from sleep at the specified frequency to run a 'tick'. During this tick, PIE will process any incoming packets, call any pending callback functions, and return to sleep. PIE runs at between 5 and 50 ticks per second, default 20.

PIE scripts consist of PHP functions that are called by PIE as appropriate, such as at startup, on receipt of a packet, at a pre-specified time, etc.

There are functions available to do common tasks such as sending packets, speaking to chat, etc., and a PIE object provides constantly-updated InSim information and a data store.

Functions that are called on receipt of an InSim packet are called with a parameter which consists of all the packet data, unpacked into an associative array. Some packets with combined values have additional indexes for the separated values, and all text fields have been made safe for windows (0 byte stripped, raw SkinID bytes converted to SkinID text string).


Requirements:
  • Windows or emulator
  • LFS v0.7+ (InSim v9+)
  • Visual C++Redistributable 2015 (often already installed) (https://www.microsoft.com/en-us/download/details.aspx?id=48145)
(You do NOT need to install PHP)


'Hello world' demo:
Attached images
image1.jpg
Attached files
PIEv0.1.1.zip - 9 MB - 353 views
tutorials.zip - 727.7 KB - 278 views
PIEv0.1.2.zip - 9.1 MB - 29 views
This is really cool, good work!
#3 - Racon
An update for PIE! (link in OP).

It's mostly new LFS packets (notably AI control!), but a few small tweaks and bugfixes too and an update to the quick-reference text.

It is fully compatible with previous versions.

Updates in version 0.1.2:

FIX: Added missing constants/defines
FIX: Added missing ServerStatus in STA packet
FIX: Added missing CPP packet
FIX: Auto-shutdown if 3 pings missed
FIX: Removed 'ghost data' from MCI tracking
LFS UPDATE: License byte added to NCI packet
LFS UPDATE: New PLH packet (PLayer Handicaps)
LFS UPDATE: New LCL (SMALL) packet (Local Car Lights)
UPDATE: Added PIE_PLH array, player handicap data indexed by PLID
UPDATE: Added 'Flags' to BTC packet (mirror of 'CFlags')
UPDATE: Multiple MCI packets in a set will be concatenated
UPDATE: Added script type (local/host) to ;PIE command report
UPDATE: Added PIE_buttonsafe boolean to PIE object, true when screen is safe for buttons
UPDATE: Added PIE_buttonsafe function, called when screen becomes safe for buttons
UPDATE: Added PIE_buttonunsafe function, called when screen becomes unsafe for buttons
LFS UPDATE: New IPB packet (get/set IPBans)
LFS UPDATE: New AIC packet (AI Control)
LFS UPDATE: New AII packet (AI Info)
#4 - Pasci
Sorry, to me it's not clear where to ask question if problems exist. I hope, this thread is the right one?

If I start PIE.EXE (it doesn't matter if I use the old 0.1.1 or the new one 0.1.2) I get following error:
D:\PIE-old>pie tutorials\helloworldandquit.php
Exception(2020.2): Could not load PHP DLL in memory

The dependency is installed:


Any ideas whats going wrong?
Attached images
c++-redis.png
#5 - Racon
This thread is fine for problems.

I haven't seen this error before for any reason other than the dependency being missing. The one you have should work as it covers 2015.

The forum for the compiler I use suggests that it can happen if you're running a local WAMP server, but there's no other ideas there. ref

There's one (very specific!) thing I did find in an update log, which is Windows 11 24H2 with KB5046740 update. (They issued a fix for it, but I'm unable to upgrade to that version.)

FGED GREDG RDFGDR GSFDG