Page 1 of 1

Javascript Function to PHP Function

Posted: Fri Aug 13, 2004 12:36 am
by ForceGamerDotCom
I was wondering how you could convert a Javascript function to a PHP function.

This is the Javascript:

Code: Select all

function main() {
	// change this to if autod2jsp is NOT running to use the old starter.d2j instead of stopping
//	if(!sendDDE(1, "autod2jsp", "command", "", "")) stop();

	controlData.clickDelay = clickDelay;
	controlData.textDelay = textDelay;

	if(parseFloat(me.version)>=0.42) registerEvent( EVENT_SCRIPTMSG, scriptmsgHandler );

	while( gameData.isRunning ) {
  if( gameData.needsData ) {
  	gameData.requestSettings( );
  } else {
  	if(me.ingame) {
    gameData.setLocation( "In Game" );
    lastGameStatus = 2; // in game successful
    delay(500);
  	} else {
    location = controlData.getLocation();

    if(location) {
    	gameData.setLocation( location.name );
    } else {
    	gameData.setLocation( "Unknown Location" );
    }

    locationAction( location );
  	}
  }
  
  delay( 100 );
  while( gameData.isPaused ) {
  	gameData.location = "Paused";
  	gameData.updateStatus(); // manually do it, so we don't ping out
  	delay(500);
  }
	}
}
Now I need to somehow transfer that all into PHP coding.

How would I write out the gameData.location (Javascript) into PHP? Would it look like this:

Code: Select all

gameData['location']
Or am I going about it all wrong?

If someone could help me it would be much appreciated.