DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • June 22, 2018, 06:22:54 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Frustrating Parse Error!  (Read 3616 times)
0 Members and 1 Guest are viewing this topic.
Ironman
Guest
« 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");
   $session[user][specialinc]="oldhag.php";
}
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;
}
else
{
$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][maxhitpoints]++;
$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!

Thanks!
 
Logged
Peanut_Butter_Wolf
Guest
« 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] <--

Logged
Ironman
Guest
« 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.
Logged
Chojin
Guest
« 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];
Logged
Ironman
Guest
« Reply #4 on: August 08, 2004, 08:32:55 PM »

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


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

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