Author Topic: SMFPets is Finally Here (0.1 out)  (Read 105725 times)

Offline tomekent

Re: SMFPets is Finally Here
« Reply #45 on: March 02, 2007, 10:56:28 pm »
i see it in bablylon theme, is there a bit of code i could put in one of the files to make it visible, prerferable a picture button that i could add instead of just text.

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #46 on: March 03, 2007, 04:46:23 am »
Well, the link that is placed is textual, just like the other profile links...

In other news, I have fixed it so that while your pets are training the button disappears and when they are done the button reappears to finish...

In pet_engine.php find the function trainMenu replace the entire function with this:
Code: [Select]
function trainMenu() {
global $txt, $scripturl;
   $date = date('z');
   if ($date < 10) {
   $date = '00'.$date;
   }
   elseif ($date < 100) {
   $date = '0'.$date;
   }
   $date = date('y').$date.date('H');
if ($this->training == 1) {
if ($date > ($this->training_date($this->trainingend))){
$middlestring = $txt['pets_course_finish2'];
$command = $txt['pets_train_pet'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
else{
$middlestring = sprintf($txt['pets_course_taking'], $this->training_date($this->trainingend));
$command = $txt['pets_train_pet'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
}
}
else {
$middlestring = $txt['pets_train_cost'].$this->calcTrainCost();
$command = $txt['pets_train'];
$returnstring = "<form method='post' action='".$scripturl."?action=shop;do=pets;type=train;pet=".$this->id."'> ";
$returnstring .= $middlestring;
$returnstring .= " <input type='submit' value='{$command}'></form>";
}
return $returnstring;
}

And add this line to the shop.english.php
Code: [Select]
$txt['pets_course_finish2'] = 'Your pet has completed its course!';
Don't tell me to get into shape...I have a shape...It is round!


Alexander

  • Guest
Re: SMFPets is Finally Here
« Reply #47 on: March 03, 2007, 06:13:17 am »
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Neil but Jr.!',
hunger = 9,
age = 1,
train' at line 7
File: /home/zeldaevo/public_html/forums/Sources/shop/pet_engine.php
Line: 236



One of my members bought a pet, and got this error, and now the whole shop's down.

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #48 on: March 03, 2007, 06:23:19 am »
's Neil but Jr.

what is that from?

Basically, you need to escape the apostrophe with an \ right before it
Don't tell me to get into shape...I have a shape...It is round!


Alexander

  • Guest
Re: SMFPets is Finally Here
« Reply #49 on: March 03, 2007, 06:52:42 am »
The persons pet is named Neil Jr, and the description is :"I's Neil but Jr.!", should I just tell him to delete the apostrophe?

http://www.zeldaevolution.com/forums/index.php?action=profile;u=25;sa=showPets

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #50 on: March 03, 2007, 07:09:00 am »
that or escape it...either way will get rid of the error
 EDIT:

For some reason the pet mod will not read anything but the first skill...I have them set properly
Code: [Select]
$this->skill[1] = new skill;       //Required for making new skills.

but it only will list the first one.
« Last Edit: March 03, 2007, 07:59:47 am by TechnoDragon »
Don't tell me to get into shape...I have a shape...It is round!


Offline Basil Beard

Re: SMFPets is Finally Here
« Reply #51 on: March 03, 2007, 11:12:31 am »
Is skills_cnt set to the right value? Are they zero indexed.

I always thought SMF auto escaped quote marks. I guess I could just add that to the desc and name code, wouldn't be too hard.

Quote
The number one rule of coding with SMF is: "If it is not a template file, DO NOT ECHO" =D.
SMFShop, you mean Wink. SMF uses echo statements in the templates, but the way SMFShop works is different (yeah, I know, it's fundamentally flawed, but I wanted to have nice self-contained items Smiley

That was sorta my point. Nothing gets echoed if it is not in a template. Different mods use different templates to different degrees of use--but you still don't echo without a template, right?
Arrrrr!

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #52 on: March 03, 2007, 11:36:43 am »
ROFL

Didn't even notice that variable!

Don't tell me to get into shape...I have a shape...It is round!


Alexander

  • Guest
Re: SMFPets is Finally Here
« Reply #53 on: March 04, 2007, 03:26:16 am »
that or escape it...either way will get rid of the error
Sorry but I'm still confused about it, where would I find what I need to change?

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #54 on: March 04, 2007, 05:04:26 am »
most likely in the database for the pet description
Don't tell me to get into shape...I have a shape...It is round!


Offline littleone

Re: SMFPets is Finally Here
« Reply #55 on: March 06, 2007, 01:12:55 pm »
Will this work or am I off here ?  I think the return statement is wrong I didnt know what to do lol

Code: [Select]
function use_skill_2() {
global $db_prefix, $ID_MEMBER;
$value = mt_rand(1,5);
$result = db_query("UPDATE {$db_prefix}members SET maxap = maxap + {$value} WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "{$this->name} climbs a near-by tree and drops down ".$value." to your skill points!";
}
« Last Edit: March 06, 2007, 01:33:16 pm by littleone »

Offline littleone

Re: SMFPets is Finally Here
« Reply #56 on: March 06, 2007, 01:28:00 pm »
Also.... what does this refer to:

$this->skills_cnt = 1; //The number of skills the pet can use

as in the skill[0] would mean the count should be one and if you have skill[1] or [2] the count should be 2 or 3 respectively?




Another thing...

What is the difference between the Increase Skill and the Restore Skill files? The only thing I noticed different between the two was maxap and curap.

Does that mean that a user can only have so many skill points?  Like I have certain skills that require 25 points, would that not work or am i just missing something in the 2 files that makes them difference?
« Last Edit: March 06, 2007, 01:32:53 pm by littleone »

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #57 on: March 06, 2007, 03:07:09 pm »
ok, first the two files, one restores used akill points rather than wait until the next day...the max ap (skill oints) raises the maximum number of skill points your pet can have.

Third, yes I found that out too, the skills_cnt refers to the number of skills they can have...so if you make a pet and create three skills for it you have to change that to 3
Don't tell me to get into shape...I have a shape...It is round!


Offline Aruta

Re: SMFPets is Finally Here
« Reply #58 on: March 06, 2007, 08:28:19 pm »

Well I fixed most of my problems with the stuff posted here. Is all this going to be added to a new release?

Also I still have 1 problem. I created two breeds now, but since I bought a second pets (diffenent breed) I cant feed my first pet.
When I select the food item the pull-down menu only shows my last pet, not the first.
Is there a way to fix this? If I need to post more info please let me know and I will do that asap.

Thanx in advance!

Offline TechnoDragon

Re: SMFPets is Finally Here
« Reply #59 on: March 06, 2007, 09:08:31 pm »
i will take a look at the code in that item to see what's wrong later today...thanks for the info!
Don't tell me to get into shape...I have a shape...It is round!