DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • March 22, 2019, 07:02:15 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Vital info visualisation  (Read 3730 times)
0 Members and 1 Guest are viewing this topic.
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« on: June 04, 2004, 07:28:53 AM »

I've implemented on my server a kind of permanent att/defence points ($session[user][bonusattack] & [bonusdefence]) and I'd like to show them in Vital Info frame beside the total att/def points. I've done some test and I can't find a way to do it. No prob to show on a separate line, this is the code
Code:
      .($session['user']['alive']?
          templatereplace("statrow",array("title"=>"Attacco","value"=>$atk))
         .templatereplace("statrow",array("title"=>"`4Att.Perm.","value"=>"`b`\$".$u[bonusattack]."`b"))
         .templatereplace("statrow",array("title"=>"Difesa","value"=>$def))
         .templatereplace("statrow",array("title"=>"`4Dif.Perm.","value"=>"`b`\$".$u[bonusdefence]."`b"))
         :
          templatereplace("statrow",array("title"=>"Psiche","value"=>10 + round(($u['level']-1)*1.5)))
         .templatereplace("statrow",array("title"=>"Spirito","value"=>10 + round(($u['level']-1)*1.5)))
         )
But this is the result:
Attack 14
Att.Perm. 2
Defence 14
Perm.Def. 3
What I should get instead is something like this:

Attack 14 / 2
Defence 14 / 3

Any hints on how do this ?

Thanks all
Rgds Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Voratus
Guest
« Reply #1 on: June 04, 2004, 08:10:41 AM »

Just combine the values into one:
templatereplace("statrow",array("title"=>"Attacco","value"=>$atk ." / `b`\$".$u[bonusattack]."`b"))

should display $atk / $u[bonusattack] (but with the values in)
Logged
Artte
Guest
« Reply #2 on: June 04, 2004, 09:09:09 AM »

You would think that Voratus.  I tried that once and it didn't take.  I had to modify the $atk and $def variables before that part.  Here is my code.  It's not exactly what you want as my code is just showing stats like central does.

I put this after it calculated the buffs into $atk and $def.

Code:
       $mod_atk = $atk - $u[attack];
        if ($mod_atk == 0) { $atk = "`^".$u[attack]; }
        if ($mod_atk > 0) { $atk = "`^".$u[attack]."`@+".$mod_atk; }
        if ($mod_atk < 0) { $atk = "`^".$u[attack]."`$".$mod_atk; }

        $mod_def = $def - $u[defence];
        if ($mod_def == 0) { $def = "`^".$u[defence]; }
        if ($mod_def > 0) { $def = "`^".$u[defence]."`@+".$mod_def; }
        if ($mod_def < 0) { $def = "`^".$u[defence]."`$".$mod_def; }

I guess you could rework it to fit your system Excalibur.
Logged
Excalibur
Member
Mod God
*****
Offline Offline

Posts: 573


I'm a newbie, plz forgive me!


View Profile WWW
« Reply #3 on: June 04, 2004, 10:23:25 AM »

An idea has lighten up in my mind Cheesy.

Code:
$atk_mod=$atk." / ".$session[user][bonusattack];
$def_mod=$def." / ".$session[user][bonusdefence];

          templatereplace("statrow",array("title"=>"Attacco","value"=>$atkt_mod))
         .templatereplace("statrow",array("title"=>"Difesa","value"=>$def_mod))
I haven't tested it yet, but it should work ... at least I hope so  Grin

Thanks all for the fast reply

Rgds Excalibur
Logged

Spock: Random chance seems to have operated in our favor.
McCoy: In plain, non-Vulcan English, we've been lucky.
Spock: I believe I said that, Doctor.
Voratus
Guest
« Reply #4 on: June 04, 2004, 11:48:01 AM »

Code:
.templatereplace("statrow",array("title"=>"Hitpoints","value"=>"$u[hitpoints]`0/$u[maxhitpoints]"))
That is directly out of my common.php, which displays hit points as HP/MaxHP.
I may not have gotten the syntax exactly right in what I posted, but throwing two variables into the "value" field does work.    Wink

And since the above does work, then the following should work, using his variables:
Code:
.templatereplace("statrow",array("title"=>"Attacco","value"=>"$atk`0/$u[bonusattack]"))
« Last Edit: June 04, 2004, 11:52:50 AM by Voratus » Logged
Artte
Guest
« Reply #5 on: June 04, 2004, 12:01:28 PM »

I guess my server hates me when I try to do that.  Always more than one way to skin a dragon!
Logged
Voratus
Guest
« Reply #6 on: June 05, 2004, 08:51:11 PM »

It did take me being quite inventive to get it to display base attack/defense +/- buff attack/defense (i.e. Attack: 15+3.5). That one didn't come out as pretty (as I created several different variables to get it to display "just right"), but it was also the change I did first, so I might've gotten better with further attempts at changing the displays around. Wink
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

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