DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: gilgalad on May 29, 2005, 04:54:32 AM



Title: The meaning of PigPen
Post by: gilgalad on May 29, 2005, 04:54:32 AM
what s the meaning of this tittle :) some of my players asking this... i dont know how they get this tittle... i think with a module. can this be a odor modules effect.. sorry for this silly question :)


Title: Re:The meaning of PigPen
Post by: Dannic on May 29, 2005, 07:44:39 AM
extremely dirty and smelly.  Comes from the Charlie brown comic strip.


Title: Re:The meaning of PigPen
Post by: Freeze on May 29, 2005, 10:46:03 AM
Its caused by the Odor/bladder module of Lonnyl's.


Title: Re:The meaning of PigPen
Post by: gilgalad on May 29, 2005, 02:03:21 PM
Thankies guys, u r great :)


Title: Re:The meaning of PigPen
Post by: Elessa on June 01, 2005, 05:35:24 AM
more specifically

(http://dragonprime.net/users/Elessa/meet_pig_pen_big.gif)


Title: Re: The meaning of PigPen
Post by: josefprado on July 03, 2006, 11:38:16 AM
Hi,

Is there any way for the module set different classes for male and female?

I look at the code and as far as I undestood, it only insert PigPen for both, but for some languages (like latin languages) we need to have different adjectives for the two sex.

So, im portuguese we would use:

Imundo - For man
Imunda - For female

(or some kind of variation of it, but certainly we would need the 2 options)

Does anyone know how to make this module "2 sex compliant" :)
(Remember that i don't know how to code :P)

Thanks,



Title: Re: The meaning of PigPen
Post by: shadowblack on July 04, 2006, 01:39:35 AM
I think you'll have to edit the module and add an "if" statement:
if ($session['user']['sex']==0){
//code for male title here
}else{
//code for female title here
}

Something like that.


Title: Re: The meaning of PigPen
Post by: XChrisX on July 04, 2006, 01:46:34 AM
you should use
Code:
if ($session['user']['sex'] == SEX_MALE)

It's correct, that SEX_MALE is equivalent to 0 but as we had to change the clanranks' values for v1.1.x all modules which used "clanrank == 2" are not compatible with this anymore.


Title: Re: The meaning of PigPen
Post by: josefprado on July 04, 2006, 07:33:08 AM
Hummmmm

I did some s**t and I'm getting this error:

Parse error: syntax error, unexpected T_CASE in /home/lddvcomb/public_html/modules/odor.php on line 111

Since I cant attach files here, I will post the code here:

Code:
<?php
//contribs - mprowler
function odor_getmoduleinfo(){
$info = array(
"name"=>"Odor",
"version"=>"1.45",
"author"=>"`#Lonny Luberts",
"category"=>"PQcomp",
"download"=>"http://www.pqcomp.com/modules/mydownloads/visit.php?cid=3&lid=11",
"vertxtloc"=>"http://www.pqcomp.com/",
"prefs"=>array(
"Odor Module User Preferences,title",
"odor"=>"Odor Level,int|0",
),
"settings"=>array(
"Odor Module Settings,title",
"newday"=>"Odor Increase on New Day,int|1",
),
);
return $info;
}

function 
odor_install(){
if (!is_module_active('odor')){
output("`4Installing Odor Module.`n");
}else{
output("`4Updating Odor Module.`n");
}
module_addhook("charstats");
module_addhook("dragonkill");
module_addhook("newday");
module_addhook("village");
module_addhook("battle-victory");
module_addhook("battle-defeat");
module_addeventhook("forest""return 100;");
return true;
}

function 
odor_uninstall(){
output("`4Installing Odor Module.`n");
return true;
}

function 
odor_dohook($hookname,$args){
global $session;
switch($hookname){
case "charstats":
if ($session['user']['alive'] == 1){
$len=0;
  $len2=0;
  $max=40;
  $odorval get_module_pref('odor');
    for ($i=0;$i<$max/2;$i+=1){
   if ($odorval>$i$len+=2;
  }
  $pct round($len $max 1000);
  $nonpct 100-$pct;
  if ($pct 100) {
   $pct 100;
   $nonpct 0;
  } elseif ($pct 0) {
   $pct 0;
   $nonpct 100;
  }
  $color "`^";
  $barcolor "#F7E827";
  $barbgcol "#777777";
  $odor "";
  $odor .= "`b$color$pct%`b";
  $odor .= "<br />";
  $odor .= "<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>";
  setcharstat("Vital Info","Odor",$odor);
   }
break;
case "dragonkill":
set_module_pref('odor'0);
break;
case "newday":
if (get_module_pref('odor') > 2$session['user']['charm']-=(get_module_pref('odor')-2);
set_module_pref('odor'get_module_pref('odor') + get_module_setting('newday'));
if (get_module_pref('odor')>and $session['user']['clean']<15addnews("%s`2 is pretty stinky!",$session['user']['name']);
if (get_module_pref('odor')>14 and get_module_pref('odor')<20){
output("You can hardly stand the smell of yourself!");
addnews("%s`2 smells really bad!",$session['user']['name']);
}
if (get_module_pref('odor')>19){

if (
$session['user']['sex']==SEX_MALE){
output("You have earned the title of Porquinho for being so dirty!`n");
addnews("%s `7was awarded the title of Porquinho for being so dirty!",$session['user']['name']);
$newtitle="Porquinha";
require_once("lib/names.php");
$newname change_player_title($newtitle);
$session['user']['title'] = $newtitle;
$session['user']['name'] = $newname;
}
}else{
output("You have earned the title of Porquinha for being so dirty!`n");
addnews("%s `7was awarded the title of Porquinha for being so dirty!",$session['user']['name']);
$newtitle="Porquinha";
require_once("lib/names.php");
$newname change_player_title($newtitle);
$session['user']['title'] = $newtitle;
$session['user']['name'] = $newname;
}

}


break;
case "village":
tlschema($args['schemas']['marketnav']);
   addnav($args['marketnav']);
   tlschema();
addnav("Bath House""runmodule.php?module=odor");
break;
case "battle-victory":
if (e_rand(1,3) == 3set_module_pref('odor'get_module_pref('odor') + 1);
break;
case "battle-defeat":
if (e_rand(1,3) == 3set_module_pref('odor'get_module_pref('odor') + 1);
break;
}
return $args;
}

function 
odor_runevent(){
global $session;
$op httpget('op');
if (e_rand(1,2) == and $op <> "bathe"){
output("You trip! Ohhhh! right into a mud puddle! You are covered in mud!");
set_module_pref('odor'get_module_pref('odor') + 2);
}else{
$session['user']['specialinc']="module:odor";
if ($op == ""){
output("You come across a small river, the water looks clean and fresh. What a great place to clean up!");
addnav("Bathe","forest.php?op=bathe");
addnav("Continue on Your way","forest.php?op=continue");
}
if ($op == "continue"){
$session['user']['specialinc']="";
redirect("forest.php");
}
if ($op == "bathe"){
set_module_pref('odor'0);
output("You strip down to your skivies and hop in the river. The bath leaves you feeling and smelling much better!");
$session['user']['specialinc']="";
addnav("Continue on Your way","forest.php");
}
}
}

function 
odor_run(){
global 
$session;
$op httpget('op');
page_header("Bath House");
output("`c`b`&Bath House`0`b`c`n`n");
if (
$op == ""){
output("`2You enter the bath house and notice that everything looks very damp, including the old woman tending");
output("the baths. There are curtains around all of the baths for privacy. You think a nice steamy hot bath");
output("would feel good about now. The old woman looks at you and points to a sign on the wall. The sign states");
output("that a bath will cost you `65 `2gold.`n");
addnav("Take a Bath","runmodule.php?module=odor&op=bathe");
modulehook("bathhouse",$texts);
addnav("Back to the Village","village.php");
}
if (
$op == "bathe"){
if ($session['user']['gold']<5){
output("`2You dig for the 5 gold in your pouch, but come up short. The old woman just turns away and points to the door.`n");
addnav("Back to the Village","village.php");
}else{
output("`2You hand the old woman your 5 gold and without saying a word leads you to a bath and pulls the curtain");
output("You undress and slip into the warm water and proceed to clean the grime of the forest and the village");
output("from your body. The bath feels heavenly and you could stay here forever, but just as you get settled in");
output("the old woman abruptly pulls back the curtain and gestures for you to get out. She closes the curtain and");
output("leaves you to dry off and get dressed. You feel much better after your bath!`n");
set_module_pref('odor'0);
$session['user']['gold']-=5;
addnav("Back to the Village","village.php");
}
}
//I cannot make you keep this line here but would appreciate it left in.
rawoutput("<div style=\"text-align: left;\"><a href=\"http://www.pqcomp.com\" target=\"_blank\">Bathhouse and Odor by Lonny @ http://www.pqcomp.com</a><br>");
page_footer();
}
?>


Title: Re: The meaning of PigPen
Post by: SaucyWench on July 04, 2006, 07:37:51 AM
Paste me lines 110 - 112 and I'll tell you what the error is. More than likely you forgot a closing brace }

Go back and look at the line *before* the error.

Edit: This is your own fault when your tab stops are all over the place ;)
If you are religious about making your indenting perfect you will never get lost like this - it will be obvious straight away because one of the indents will be wrong.


Title: Re: The meaning of PigPen
Post by: SexyCook on July 04, 2006, 07:42:50 AM
The } on line 107 is, as far as I can see, unnecessary. You might want to use a program that highlights ) and }, I use PSPad myself.


Title: Re: The meaning of PigPen
Post by: robert on July 04, 2006, 07:47:29 AM
Hummmmm

I did some s**t and I'm getting this error:

Parse error: syntax error, unexpected T_CASE in /home/lddvcomb/public_html/modules/odor.php on line 111


Using a quality php editor will help you find such minor errors.
Also, the error message told you exactly what what wrong
syntax error, unexpected T_CASE
and approx where it was
odor.php on line 111

you may find the error on that line or sometimes a few lines before

just a quick glance at the code you provide, you have a brace } on line 107 which dont belong there


Title: Re: The meaning of PigPen
Post by: josefprado on July 04, 2006, 07:54:08 AM
Paste me lines 110 - 112 and I'll tell you what the error is. More than likely you forgot a closing brace }

Go back and look at the line *before* the error.

Edit: This is your own fault when your tab stops are all over the place ;)
If you are religious about making your indenting perfect you will never get lost like this - it will be obvious straight away because one of the indents will be wrong.

You were completly right!

I've left some "{" lost in the process.

(Wow, know I know why my teacher said to me that I need to learn C at the college, hehehe)

it seems to be working now, I will need only to see what happens whena user turns into a PigPen if the game will define the correct class.

Thanks, to all of you!

BTW: The tabs are in the original odor.php file, they are not mine :P


Title: Re: The meaning of PigPen
Post by: josefprado on July 04, 2006, 07:55:33 AM
Using a quality php editor will help you find such minor errors.
Also, the error message told you exactly what what wrong
syntax error, unexpected T_CASE
and approx where it was
odor.php on line 111

you may find the error on that line or sometimes a few lines before

just a quick glance at the code you provide, you have a brace } on line 107 which dont belong there

Robert,

Its the first time I do something in PHP :)
I used notepd only, hehehe


Title: Re: The meaning of PigPen
Post by: robert on July 04, 2006, 08:09:14 AM
RE:  Its the first time I do something in PHP .....I used notepad only ....

No worries, this is good learning for you.
 - 1. Using a quality php editor 'helps you', in the links area on DP check out NotePad++ or Crimson Editor, both are freeware
 - 2. Error messages pretty much tell you whats wrong, you only need to learn to understand what they are telling you
 - 3. Now you learn why most of us here at DP suggest using a quality editor to write scripts. They will auto tab as you write the file, making the indents where needed. By using auto tabs ...most common php errors will be avoided or easily found if indented properly.
 - 4. You also learn that some authors dont use proper indents. While this practice wont break the code and it will run as it should but if used ...sure makes reading the code easier for others ;)

See how much you learn already!  8) 


Title: Re: The meaning of PigPen
Post by: Talisman on July 04, 2006, 01:06:16 PM
To attach files to a post, click "Additional Options" in the Post Reply window (located under the text editting box) and you'll see the option to attach files there.

© 2018 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