
// [Hello world] //////////////////////////////////////////////////////////////
  
    The simplest program we can write for PIE is a 'hello world' program that
  connects to your LFS client (local mode). If you are using the default InSim
  port of 29999 and no admin password for your client, you don't need to set any
  settings. (The admin password can be found in LFS's cfg.txt file as the 'Game
  Admin' setting, or can be set inside LFS in the 'start new host' screen)
    
    We'll define a function called 'PIE_start' (called as soon as the connection
  is established), and within it we'll use the 'PIE_say' function (general
  purpose 'talk' function) to send 'hello world' to chat.
  
--[helloworld.php file]--------------------------------------------------------
  
<?php

function PIE_start()
  {
    PIE_say('Hello world');
  }
  
--[command line]---------------------------------------------------------------
  
> pie tutorials\helloworld.php
  
-------------------------------------------------------------------------------

[image 1]

  
    Note that this program will continue to run after having said 'hello world'.
  We can kill it using Ctrl-C in the console window it is running in, or
  clicking the X button in the top right, but these are not ideal. Both may
  leave the connection open until it times out, and both will cause any
  'PIE_shutdown' function to be skipped.
    
    In order to shut it down automatically, we can use the function 'PIE_kill'.
  We'll also speak our message locally this time (other players don't see it),
  by using the 'PIE_saylocal' function.
  
--[helloworldandquit.php file]-------------------------------------------------
  
<?php

function PIE_start()
  {
    PIE_saylocal('Hello local world');    
    PIE_kill();
  }
  
function PIE_shutdown()
  {
    PIE_say('Goodbye world');
  }
  
--[command line]---------------------------------------------------------------
  
> pie tutorials\helloworldandquit.php
  
-------------------------------------------------------------------------------

[image 2]

