DragonPrime - LoGD Resource Community

Coding Support => v0.9.7 Technical Help => Topic started by: Odyssey on June 22, 2004, 04:52:55 PM

Title: New Day...fights
Post by: Odyssey on June 22, 2004, 04:52:55 PM
Why can't I get this to work?  This is the entire code block, but what I'm having trouble is with the 3 lines - the 'marriedto' part.  I have it to where the players can marry other players, so I want the >=1 to cover all players, including Seth and Violet.  Everytime I upload it like that, I get a parse error on those lines.

If I keep:

if ($session['user']['marriedto']==4294967295 || $session['user']['charisma']==4294967295){
Which is the original code, it works fine....but, the forest fights do not get added.  So, I've got two things wrong here.

if ($session['user']['marriedto']>=1
         output("`n`%Now that you are married, you realize that you have a family to provide for.  You get 5 extra forest fights for today.`n");
         if ($session['user']['charm']<=0){
            output("`bWhen  you  wake  up, you find a note next to you, reading`n`5Dear ");
            output("`5,`nDespite  many  great  kisses, I find that I'm simply no longer attracted to you the way I used to be.`n`n");
            output("Call  me fickle, call me flakey, but I need to move on.  There are other warriors in the village, and I think");
            output("some of them are really hot.  So it's not you, it's me, etcetera etceterea.");
            $sql = "SELECT name FROM accounts WHERE locked=0 AND acctid=".$session[user][marriedto]."";
              $result = db_query($sql) or die(db_error(LINK));
            $row = db_fetch_assoc($result);
            if ($partner=="") $partner = $session[user][sex]?"Seth":"Violet";
            output("`n`nNo hard feelings, Love, $partner`b`n");
            addnews("`\$$partner has left {$session['user']['name']}`\$ to pursue \"other interests.\"");
            if ($session['user']['marriedto']>=1) $session['user']['marriedto']=0;
            if ($session['user']['charisma']==4294967295){
               $sql = "UPDATE accounts SET charisma=0,marriedto=0 WHERE acctid='$row[acctid]'";
               systemmail($row['acctid'],"`\$Divorce!`0","`6You have left `&{$session['user']['name']}`6. Marriage wasn't what is was before.");


Title: Re:New Day...fights
Post by: lonnyl on June 22, 2004, 05:45:47 PM
right off  I see

if ($session['user']['marriedto']>=1

Should be
if ($session['user']['marriedto']>=1)

Title: Re:New Day...fights
Post by: Odyssey on June 23, 2004, 04:09:58 AM
Thanks for noticing that.

  Ok, I added in the missing ), and the code isn't breaking anymore.  I still can't get the Forest Fights to add in though.  


Title: Re:New Day...fights
Post by: Excalibur on June 23, 2004, 04:51:35 AM
I still can't get the Forest Fights to add in though.  

This happens because the calculation for the FF/day is made after the marriage question.

You need to add after the final statement regarding FF, so find this line:
   $session['user']['turns'] = ($session['user']['bonusfight'] + $turnsperday + $spirits + $dkff);
After it add:
if ($session[user][marriedto] > 0) $session['user']['turns']+=5;

That should work.

Rgds Excalibur

*** EDIT ***
I'd move the output about the FF gain about the marriage AFTER the check for divorce, else you'd get the message about the gain, then if you divorce you'll never get the 5 turns  ;)

Title: Re:New Day...fights
Post by: anpera on June 23, 2004, 06:22:29 AM
Uh, this looks like my gardenflirt script. One little note for that: If if $session['user']['marriedto']>=1 is TRUE, this does NOT mean that two people are married!!

Here is what I use "marriedto" and "charisma" for:
  • marriedto>0, charisma<4294967295 : Player flirts with acctid in field marriedto, but they are NOT married yet.
  • marriedto = 4294967295 : Player is married to Violeth / Seth ('charisma' doesn't do anything in that case)
  • charisma = 4294967295 : Player is married to acctid in field marriedto.
So in your modification all players who flirtet at least once with another player would get +5 FF.

Just let the original
if ($session['user']['marriedto']==4294967295 || $session['user']['charisma']==4294967295){
in there, because it does cover all players, including Violet and Seth. And replace the
if ($session[user][marriedto] > 0)
in Excaliburs suggestion with
if ($session['user']['marriedto']==4294967295 || $session['user']['charisma']==4294967295) ;)

Title: Re:New Day...fights
Post by: Odyssey on June 23, 2004, 10:22:53 AM
Yes, your garden flirt mod is installed.  However, players are getting married through the GreyStone Chapel mod.  The problem that I kept on getting with the Garden/Flirt, is that people would be married after only one flirt, and also that a character would be married to him/herself.

  I still have to code in there, but the flirt option is commented out.  Seth/Violet are the only ones you can flirt with.  You can marry either of them, and the other characters (through the Chapel).


if ($session['user']['marriedto']==4294967295 || $session['user']['charisma']==4294967295){


if ($session['user']['marriedto']==4294967295 || $session['user']['charisma']==4294967295)

...would still work in that situation?

And then as far as the FF...  I would still add in a
within the above block of code?

© 2019 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines