Jump to content


Photo

Game Scripts?


  • Please log in to reply
6 replies to this topic

#1 Rayon

Rayon
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 July 2006 - 01:00 AM

Hello,

I have been working on an online flash based game that uses a bunch of php (& mysql) scripts to perform all actions.
I have currently run into a stump for the quest system, where I would like to have seperate php scripts for each quest (as they would all have entirely different style tasks), but I want one script to access them all.
I was wondering if theres a way to make a script execute code from another file...this is the most organized way I can think of, although if anyone has any better ideas i'de be extremely grateful.

Thanks

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 27 July 2006 - 01:34 AM

I was wondering if theres a way to make a script execute code from another file


include().

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 July 2006 - 02:25 AM

Thorpe wins the prize for most cryptic response :)
Legend has it that reading the manual never killed anyone.
My site

#4 Rayon

Rayon
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 July 2006 - 12:07 PM

Only thing with include is you cannot pass variables it seems, or can you?

The game is online, and uses accounts, so I need to pass a temporary ID variable through to the script, I have tried simply putting include("test.php?stringy=test");

however I get file open errors when I try that. (I thought of that well before my first post, but I tend to always forget to add more/clear information).

#5 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 July 2006 - 12:21 PM

As far as I'm aware, include doesn't allow you to append a query string. You'll have to define your variables before you include the files...
<?php
$stringy = "test";
include "test.php";
?>


#6 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 27 July 2006 - 12:30 PM

if you're simply wanting to run a script and get a response, you can check into using fsockopen() or something similar to actually run the script. then, whatever is output to the screen is your response that is returned.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#7 Rayon

Rayon
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 July 2006 - 07:44 PM

Alright, thanks for the help





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users