Page 1 of 1

A real problem $strXP not going any higher than 16 o_O

Posted: Thu Dec 07, 2006 9:48 pm
by Mythic Fr0st
Can someone tell me why my variable $strXP isnt going any higher then 16?, it should be im confused o_O


Code: Select all

<?php
session_start();  
?>
<html>
<body>
<head>
<style type='text/css'>
body
{
background-image:
url('SilverBG.jpg')
}
</style>
</head>
<DIV STYLE='Position: absolute; top: 0; left: 0;'>
<img src="Mythic Aeons Banner.jpg" width="1024" height="1">
</div>
<DIV STYLE='Position: absolute; Top: 250; Left: 25;'>
<!--<td style="color: #FFFFFF;">lots of text here</td>
Color group of text -->
<?php
//warrior stats
if (!isset($strlvl)) 
{$strlvl=4;}

if (!isset($strXP))
{$strXP=0;}

if (!isset($ML))
{$ML=1;}

if (!isset($strREQ))
{$strREQ=$strlvl * $ML * $strlvl;}

//dex
//$dexXP=0;
//$dexlvl=4;
//def
//$defXP=0;
//$deflvl=3;
//int
//$intXP=0;
//$intlvl=2;
//focus
//$focXP=0;
//$foclvl=2;
//lifemagic
//$life=12;
//$mag=3;
//other
//$sxp=0;
//$gold=10;
//
//multiplications
if ($strXP=$strlvl * $ML * $strlvl)
{
$strlvl=$strlvl+1;
$strREQ=$strlvl * $ML * $strlvl;
}
echo $strXP.'<br />';
echo "<font color='blue' size='3'>Str XP: ".$strXP." / ".$strREQ;
$strXP=$strXP+1;
?>
</div>
<DIV STYLE='Position: absolute; Top: 375; Left: 0;'>
</body>
</html>
it displays only Str XP: 0/16 then after a few clicks it changed to 16/25 and hasnt changed back since:/
can anyone help?

(what first happend, is when I first added the thing to inrease $strlvl, strXP jumped from 0 to 16, and I think thats whats happening, its not remembering the value? perhaps I should use $_SESSION or Globals?

Posted: Thu Dec 07, 2006 9:51 pm
by aaronhall

Code: Select all

if ($strXP=$strlvl * $ML * $strlvl)
This will always return true. Use two equal signs (==) for comparison.

ty

Posted: Thu Dec 07, 2006 9:58 pm
by Mythic Fr0st
Thanks, I used session though, and it started working, (Do you think it'd work without it?)

Posted: Thu Dec 07, 2006 10:00 pm
by aaronhall
I'm not real sure what it is you're trying to do, but the problem I pointed out should be fixed if you are trying to do a comparison, and not a string assignment.