DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • August 25, 2019, 06:14:36 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: Frustrating Parse Error!  (Read 4158 times)
0 Members and 1 Guest are viewing this topic.
« on: August 08, 2004, 04:51:24 PM »

I'm trying to write what I thought was a simple forest event, but I keep running into a parse error which I don't understand.  It is driving me up a wall, and it must be something terrible small that I just keep looking past.

Here's the code:

if (!isset($session)) exit();

Old Hag Special Forest Event
for Legend of the Green Dragon v0.9.7 +JT
Version 1.0 (08/08/04)
By Gary M. Hartzell

This is my remake of the Old Hag Forest Event from LORD.
Just upload it into your "special" directory.

$hp = $session[user][hitpoints];
$maxhp = $session[user][maxhitpoints];
$halfhp = $hp /2;

if ($HTTP_GET_VARS[op]=="")
output("As you are wandering through the forest, an ugly old hag appears before you.`n`n");
output("\"Give me a gem, and I'll make ye feel better,\" she screeches.`n`nDo you give her the gem?");
addnav("Give her a gem","forest.php?op=yes");
addnav("Don't do it","forest.php?op=no");
else if ($HTTP_GET_VARS[op]=="no")
output("\"Humph,\" replies the hag.  She waves her cane before her and vanishes.");
else if ($HTTP_GET_VARS[op]=="yes")
if ($session[user][gems] < 1)
output("\"Ye have no gems, ye lyin' fool!\" the hag screams.  She strikes you between the eyes with her cane and vanishes.");
$session[user][hitpoints -= $halfhp;
$session[user][gems] --;
output("She waves her cane in front of your face, and you feel a surge of energy go through your body`n`nYOU ARE COMPLETELY HEALDED, AND GAIN 1 MAX HIT POINT!");
$session[user][hitpoints = $session[user][maxhitpoints];


And the error:

Parse error: parse error, expecting `']'' in /usr/www/users/imgary/logd/special/oldhag.php on line 35

I actually wanted to make it so that, if the user's hitpoints were not equal their max hit points, that they would only get healed and only get the extra max hp if they were 100% health going into the event.  However, I thought the problem was that I was screwing up my braces somewhere in the nested if/else statements.  Simplifying the script didn't help, however.

I guess this is more an php problem than an actual LOGD coding issue, but I'm pulling out my hair here!

« Reply #1 on: August 08, 2004, 05:19:30 PM »

you're missing a right bracket on  line 35

$session[user][hitpoints -= $halfhp;

$session[user][hitpoints] <--

« Reply #2 on: August 08, 2004, 05:35:53 PM »

I have a closing brace on the next line.  I put in another closing brace, but get the same error.  Putting a closing brace before this line wouldn't make any sense.
« Reply #3 on: August 08, 2004, 08:20:45 PM »

Ironman, reread Peanut_Butter_Wolf's post.

You are missing array-brackets. At the very end there is another one missing:

$session[user][hitpoints = $session[user][maxhitpoints];

should be

$session[user][hitpoints] = $session[user][maxhitpoints];
« Reply #4 on: August 08, 2004, 08:32:55 PM »

DOH!  Okay, thank you -- both of you.
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
97 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search