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

Thank you.

PHPInSimMod (PRISM) 0.3.0
  • Refactored Core & Modules
  • PRISM can be global'ed for easy access to variables.
  • HTTP server for PRISM with test web page.
  • Telnet server for remote administration.
  • Experimental telnet admin accounts page.
  • Packet properties can now be chained like methods for a quick write of variables.
  • Added admin functions
    plugin::isAdmin()
    plugin::isAdminGlobal()
    plugin::isAdminLocal()
    plugin::isImmune()
  • Added admin commands in the admin plugin.
    `prism kick`
    `prism ban`
    `prism spec`
    `prism pit`
  • PRISM now quits when there are no active connections.
  • Game state information now stored on a per host basis.
  • Made protected propertys in the packets class are read only. (Via __get()).
Alrightie! Here we go!

1) Why does the initial setup crash when you try to configure a HTTP server while it is not reachable. And... It is not fixable anymore unless you throw away the generated ini's and start configuring all over again?

2) What does this line mean [cvars.ini]? ;
prefix = "!"
can the way of communicating with PRISM altered this way?

3) Is it possible that PRISM announces itself upon successful INSIM connection? I now get a lot of IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr. But if I try any command, it does not respond at all. Need to find out why, maybe because another InSim is active at the same moment.
Quote from cargame.nl :Alrightie! Here we go!

1) Why does the initial setup crash when you try to configure a HTTP server while it is not reachable. And... It is not fixable anymore unless you throw away the generated ini's and start configuring all over again?

2) What does this line mean [cvars.ini]? ;
prefix = "!"
can the way of communicating with PRISM altered this way?

3) Is it possible that PRISM announces itself upon successful INSIM connection? I now get a lot of IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr. But if I try any command, it does not respond at all. Need to find out why, maybe because another InSim is active at the same moment.
  1. No idea, so myself or Victor will have to look into that. You do know that PRISM is the HTTP server, your not connection to your own right? PRISM becomes like apache, it serves the pages not apache.
  2. That's the character used to tell LFS to hide that message from chat, it also sets a special bit in the MSO packet that tells PRISM that this chat message is also an InSim command coming from that client.
  3. It does, as all InSim programs do on the host side. It does not display anything to the chat because I see that as intrusive. But I'll add it to a welcome message plugin that you can change how you see fit.
Quote from cargame.nl :Alrightie! Here we go!

1) Why does the initial setup crash when you try to configure a HTTP server while it is not reachable. And... It is not fixable anymore unless you throw away the generated ini's and start configuring all over again?

please post your console log of 'setup crashing' so we can see what happened and when. In these cases you always should supply more information because saying 'it crashes' doesn't mean much to me. It doesn't crash here, so I need to know where to look -> I need your logs (what you see on the screen - just copy paste it)
Or at least try to verbally explain where it went wrong. Like maybe after you entered a certain piece of information that prism didn't like.
OK...

Quote :***HTTP SETUP***
You now have the chance to manually enter the details of the http server.
Afterwards your http settings will be stored in ./config/http.ini for future use
.

Would you like to setup the web server? [yes/no] : yes
On which IP address should we listen? (blank means all) :
On which Port should we listen? : 80
Do you want to restrict access to the admin website with a http login query? [ye
s/no] : no

Generated config/http.ini
Error opening http socket : Er is geprobeerd toegang te verkrijgen tot een socke
t op een volgens de toegangsmachtigingen niet toegestane manier.
(0)
Fatal error encountered. Exiting...
Safe shutdown: 10-04-10@00:59:09
Druk op een toets om door te gaan. . .

Windows 7. Firewall and any other stupid protection is off.

After restarting PRISM it only shows this;

Quote :Loaded cvars.ini
Loaded hosts.ini
Loaded http.ini
Error opening http socket : Er is geprobeerd toegang te verkrijgen tot een socke
t op een volgens de toegangsmachtigingen niet toegestane manier.
(0)
Fatal error encountered. Exiting...
Safe shutdown: 10-04-10@01:00:14
Druk op een toets om door te gaan. . .

But I personally don't need that HTTP thing right now, so I skipped it and tested some other things out... And I get these things when I try it on a server without any other InSim;

Quote :IS_MSO Packet from gtr
COMMAND -
DESCRIPTOIN
help - Displays
this command list.
prism help - Displays
this command list.
prism version - Displays th
e version of PRISM.
prism kick -
<targets> ...
prism ban -
<target> <time>
prism spec -
<targets> ...
prism pit -
<targets> ...
thetime -
Displays the time.
time -
Displays the time.
IS_TINY Packet from gtr
IS_MSO Packet from gtr
IS_MSO Packet from gtr
IS_MSO Packet from gtr
IS_TINY Packet from gtr
IS_TINY Packet from gtr
IS_MSO Packet from gtr
PHP Fatal error: Undefined class constant 'Version' in F:\php\PRISM3\plugins\ad
min.php on line 144

Fatal error: Undefined class constant 'Version' in F:\php\PRISM3\plugins\admin.p
hp on line 144

The help text (if I do !prism help) is shown in console instead of the game and !prism version crashes everything

This is PHP 5.3.3 btw, running locally in Windows 7. Sadly I cannot upgrade my Linux server to a higher PHP version yet.
Quote from cargame.nl :OK...



Windows 7. Firewall and any other stupid protection is off.

After restarting PRISM it only shows this;

You need to select a port number higher than 1024.
Or you need to run Prism as administrator, then you can use port numbers below 1024 as well.
(I'll make a note of that in the setup)
OK thats clear then... I now get a test page with some POST shizzle, input fields and environment variable data if I access [url]http://localhost:2000[/url] in my browser
-
(dawesdust_12) DELETED by Dygear
But any idea's why the data appears in the console and it crashes with a fatal error when I do !prism version?

It doesn't sound logical but if it all works correctly @yours then it might have to be PHP config / Windows version?

Puzzled.
Quote from cargame.nl :But any idea's why the data appears in the console and it crashes with a fatal error when I do !prism version?

It doesn't sound logical but if it all works correctly @yours then it might have to be PHP config / Windows version?

Puzzled.

Not sure, it never crashed for me. But I'll look into the matter. Thanks for the bug reports by the way. They are very useful.

For 0.3.1 I'm going to work on the console command to make sure that it logs these actions to file, and also make sure that the packet debug data is not sent to the screen.
Can I ask why the setup screen asks me for my LFS account password?
the password doesn't have to be the lfs account pass. Only the username should be the LFS username (so it will be recognised by prism when you join a host). But the password can be anything.
And it asks for a password because you need one to login at telnet and/or webadmin.
Ah OK, I got a little confused by the wording, I see that now.
Quote from cargame.nl :and !prism version crashes everything

To start answering my own questions.

line 144;
$MTC->UCID($ucid)->Msg('PRISM Version' . PHPInSimMod::Version)->Send();

It's in lowercase and needs to be all in UPPERCASE

and, minor bug, line 112 says;
echo sprintf("%32s - %64s", 'COMMAND', 'DESCRIPTOIN') . PHP_EOL;

It of course is ION instead of OIN.

[admin.php]
Quote from cargame.nl :
The help text (if I do !prism help) is shown in console instead of the game

Thats because it was designed to end up in the console...


foreach ($details->sayCommands as $command => $detail)
{
console(sprintf('%32s - %64s', $command, $detail['info']));
}

I have the feeling there is some unfinished business here and there

Thats not bad, but if I mention these things it would help if it's being said that it was meant this way or it's there but only partly completed.
Plugin theTime is not working for me.

I found out that line 18;
$MTC->PLID($plid)->Msg('The time is, '.date('H:i:s').', server local time.')->send();

does not work.

However,
$MTC->UCID($ucid)->Msg('The time is, '.date('H:i:s').', server local time.')->send();

Does work..
[theTime.php]

Next, it would be nice to know how it's possible to create 'buttons'.
The plan is to impalement a proper button interface in 0.5.0 as it's a pretty big task.
Quote from cargame.nl :Alrightie! Here we go!

1) Why does the initial setup crash when you try to configure a HTTP server while it is not reachable. And... It is not fixable anymore unless you throw away the generated ini's and start configuring all over again?

2) What does this line mean [cvars.ini]? ;
prefix = "!"
can the way of communicating with PRISM altered this way?

3) Is it possible that PRISM announces itself upon successful INSIM connection? I now get a lot of IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr, IS_NLP Packet from gtr. But if I try any command, it does not respond at all. Need to find out why, maybe because another InSim is active at the same moment.

Quote from cargame.nl :The help text (if I do !prism help) is shown in console instead of the game and !prism version crashes everything

This is PHP 5.3.3 btw, running locally in Windows 7. Sadly I cannot upgrade my Linux server to a higher PHP version yet.

Quote from cargame.nl :To start answering my own questions.

line 144;
$MTC->UCID($ucid)->Msg('PRISM Version' . PHPInSimMod::Version)->Send();

It's in lowercase and needs to be all in UPPERCASE

and, minor bug, line 112 says;
echo sprintf("%32s - %64s", 'COMMAND', 'DESCRIPTOIN') . PHP_EOL;

It of course is ION instead of OIN.

[admin.php]

Quote from cargame.nl :Thats because it was designed to end up in the console...


foreach ($details->sayCommands as $command => $detail)
{
console(sprintf('%32s - %64s', $command, $detail['info']));
}

I have the feeling there is some unfinished business here and there

Thats not bad, but if I mention these things it would help if it's being said that it was meant this way or it's there but only partly completed.

Quote from cargame.nl :Plugin theTime is not working for me.

I found out that line 18;
$MTC->PLID($plid)->Msg('The time is, '.date('H:i:s').', server local time.')->send();

does not work.

However,
$MTC->UCID($ucid)->Msg('The time is, '.date('H:i:s').', server local time.')->send();

Does work..
[theTime.php]

Next, it would be nice to know how it's possible to create 'buttons'.
    1. As Victor stated, you must use a port number above 1024 when you run PRISM without admin privilege on a Windows box.
    2. Fixed, now possible to add a prefix for each host, but will fallback onto the cvar value if one of the host is not specified.
    3. Added this to the new welcome.php plugin. It will by default announce it's self on all servers it get's a successful connection too. (When it can.)
    1. `prism help` no longer crashes PRISM.
    1. Fixed to VERSION not Version.
    2. Fixed the spelling of Description.
  • That's correct, I output to the console right now. 63 characters is the max I can send to any one client in a single message. As I think we only have 12 lines we can use at any one time in the chat window this solution is not idea. So I have to make a button interface for this help menu. I'm just thinking up the best way to do this.
  • It might be due to the fact that you where not a player, just a client at the time. In this case, I'll make sure all commands use UCID to talk back to the client. (As I don't see AI talking.)
Quote from Dygear :It might be due to the fact that you where not a player, just a client at the time.

Correct, I was spectator.

Quote from Dygear :So I have to make a button interface for this help menu. I'm just thinking up the best way to do this.

Rock on
I've added timers to PRISM in 0.3.1, that allows for timers to fire within a tenth of a millisecond. (0.0001 seconds or 0.1 milliseconds) As this is faster then the LFS engine updates, this should provide enough room for timers to happen faster then we get packets.

There are two bugs that I'm trying to fix now that are stopping me from releasing this; They are:
  • The last button I paint to the screen, remains on the screen even after I clear it with a IS_BFN function.
  • More exact say commands don't stop less exact say commands from running.
Keep talking about buttons, I like it
Quote from cargame.nl :Keep talking about buttons, I like it

Lol, well, that bug is fixed now, so you'll like that even more . Just one thing left now.
Tried to join your test server (as it seems) but it's blocking connections from the outside
Quote from cargame.nl :Tried to join your test server (as it seems) but it's blocking connections from the outside

Indeed, I'll put my test computer into a DMZ so you can come play.

Well, come on in. My ports are open .
1

FGED GREDG RDFGDR GSFDG