DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • October 18, 2017, 01:28:50 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2 3   Go Down
  Print  
Author Topic: 98 converted bladder  (Read 8222 times)
0 Members and 1 Guest are viewing this topic.
lonnyl
Guest
« on: September 29, 2004, 10:50:13 AM »

The bladder module for 0.9.8.... works with the outhouse...  and works with the new version of chow.....

code to add to other modules to make food increase players bladder
Code:
if (is_module_active('bladder')) {
            set_module_pref("bladder", (get_module_pref("bladder","bladder") + 1),"bladder");
         }
change the number 1 accordingly...

http://www.pqcomp.com/modules/mydownloads/visit.php?cid=3&lid=36
« Last Edit: January 30, 2005, 09:22:26 AM by lonnyl » Logged
Sichae
iMod God
SVN Users
Mod God
*
Offline Offline

Posts: 3458


If ya didn't get it by now... you're hopeless...


View Profile WWW
« Reply #1 on: September 29, 2004, 10:54:36 AM »

:sighs:

And I thought I was the ruler of the "..."

:hands the crown over to Lonny:
Logged

If you didn't understand anything in the above post, don't try to attempt anything suggested.

lonnyl
Guest
« Reply #2 on: September 29, 2004, 11:01:30 AM »

Updated...Small text fix...
Logged
lonnyl
Guest
« Reply #3 on: September 30, 2004, 06:07:13 AM »

updated again.... now empties the player's bladder on every visit to the outhouse and not just the first...
Logged
lonnyl
Guest
« Reply #4 on: October 12, 2004, 12:34:07 PM »

Updated (ver 1.2).... now recognizes and updates odor module... now has peepee dance... and if a player wanders the village having to go too terribly bad will wet their pants... also should be translation ready.
« Last Edit: October 12, 2004, 12:35:08 PM by lonnyl » Logged
Boofo
Guest
« Reply #5 on: October 17, 2004, 10:29:24 AM »

Is there supposed to be a graphic with this? I get a little square with no graphic.
Logged
lonnyl
Guest
« Reply #6 on: October 17, 2004, 10:48:38 AM »

Well.... now the zip file inclues images...  Shocked
Logged
Boofo
Guest
« Reply #7 on: October 17, 2004, 12:10:12 PM »

Thank you, sir. Wink And thanks for the excellent mods. Wink
Logged
mProwler
Guest
« Reply #8 on: October 23, 2004, 10:37:15 AM »

Excellent modules, lonnyl.. installed a few of your new ones last night and am very pleased by them.  However, one thing of note that I feel should be changed.

The bars, for hunger, odor, and bladder, currently use bars based on graphic files.  This isn't the best way to do this.  As with the health, experience, and my new day bars, it should use some sort of CSS trick, to eliminate the need for another IMG.  Here's the code I added/changed in bladder.php, though it works with the other two, as well.

Starting right after the for statement on line 43, I took out the if..else statement, and added these 4 lines..

Code:
if (get_module_pref('bladder')>$i) $len+=2;
$max+=2;

After this, I closed out the for loop, and removed everything from that point all the way down to the first addcharstat() call. I replaced it with the code below.

Code:
      $pct = round($len / $max * 100, 0);
      $nonpct = 100-$pct;
      if ($pct > 100) {
         $pct = 100;
         $nonpct = 0;
      }
      if ($pct < 0) {
         $pct = 0;
         $nonpct = 100;
      }

                $color = "#ff0000";
                $bgcolor = "#777777";

      $bladder .= "<table style='border: solid 1px #000000' bgcolor='$bgcolor' cellpadding='0' cellspacing='0' width='70' height='5'><tr><td width='$pct%' bgcolor='$color'></td><td width='$nonpct%'></td></tr></table>";

This is a much better solution than using graphics, in my opinion.  Hope you find it appropriate to incorporate into the scripts. Smiley  

Regards,
-mP Grin
Logged
lonnyl
Guest
« Reply #9 on: October 23, 2004, 11:55:58 AM »

Actually I was looking into redoing the bars and also displaying the percentage with text as well for our JAWS users..... so... when I get a chance I will play around with your suggestion seeing as you are figuring the percentage already.....
Logged
mProwler
Guest
« Reply #10 on: October 23, 2004, 01:08:33 PM »

Yeah, the percentage display would be a good thing.  Here's some code for that.. *EDIT* I have included the full case "charstats" statement from my bladder.php file.  If you want to put this in, just replace the entire statement from case "charstats" to break, and insert the settings code.

Insert the following into the "settings" array in _getmoduleinfo().
Code:
        "showcurrent"=>"Show current percentage,bool|1",
         "showbar"=>"Show bladder percentage as a bar,bool|1",

The following is the full commented code from my bladder.php.  Simply replace this section in function bladder_dohook().
Code:
   case "charstats":
      // reset lengths
      $len=0;
           $len2=0;
      
      $max=40; // maximum value of bladder
      $bladderval = get_module_pref('bladder'); // get current value of bladder
           for ($i=0;$i<$max/2;$i+=1){
         if ($bladderval>$i) $len+=2;
      }

      // calculate percentage
      $pct = round($len / $max * 100, 0);
      $nonpct = 100-$pct;
      if ($pct > 100) {
         $pct = 100;
         $nonpct = 0;
      } elseif ($pct < 0) {
         $pct = 0;
         $nonpct = 100;
      }
      
      // define color variables, reset bladder string
      $color = "`$";
                $barcolor = "#ff0000";
      $barbgcol = "#777777";
      $bladder = "";

      // get module settings
      $showcur = get_module_setting("showcurrent");
      $showbar = get_module_setting("showbar");
      
      // set output string
      if (!$showcur && !$showbar) $bladder .= "`b`\$hidden`b";
      if ($showcur) $bladder .= "`b$color$pct%`b";
      if ($showbar) {
         if ($showcur) $bladder .= "<br />";
         $bladder .= "<table style='border: solid 1px #000000' bgcolor='$barbgcol' cellpadding='0' cellspacing='0' width='70' height='5'><tr><td width='$pct%' bgcolor='$barcolor'></td><td width='$nonpct%'></td></tr></table>";
      }

      // add bladder to character stats
      setcharstat("Vital Info","Bladder",$bladder);
   break;


This code replaces everything in the case "charstats" statement.

Regards,
-mP Grin
« Last Edit: October 23, 2004, 09:47:43 PM by mProwler » Logged
Boofo
Member
Mod God
*****
Offline Offline

Posts: 774


View Profile
« Reply #11 on: October 23, 2004, 02:49:29 PM »

Where does the bottom code go exactly and what gets replaced?
Logged

chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden
mProwler
Guest
« Reply #12 on: October 23, 2004, 06:15:52 PM »

Erm, the bottom code goes after the $pct calculation from the first changes I posted.  I'm sure lonnyl can make more sense of this, so if you can't get it to work, I'd just wait for a new release of the module.

If needed, I'd be happy to post a copy of the scripts I'm using, with my changes incorporated.

Regards,
-mP Cool
Logged
Boofo
Member
Mod God
*****
Offline Offline

Posts: 774


View Profile
« Reply #13 on: October 23, 2004, 07:13:53 PM »

Erm, the bottom code goes after the $pct calculation from the first changes I posted.  I'm sure lonnyl can make more sense of this, so if you can't get it to work, I'd just wait for a new release of the module.

If needed, I'd be happy to post a copy of the scripts I'm using, with my changes incorporated.

Regards,
-mP Cool

Can you pm them to me. please?
Logged

chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden
mProwler
Guest
« Reply #14 on: October 23, 2004, 09:48:21 PM »

I posted the code into the original message. Smiley

-mP
Logged
Pages: [1] 2 3   Go Up
  Print  
 
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
37 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search