Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2014, 12:59 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,855
Hwona is on a distinguished road
Default Making a Trinket System

Hello everyone! I'm working on a trinket sytem that I'm going to be sharing with everyone later on, but I was wondering whether or not this code would work for the item function(I'm pretty sure it's done wrong):
PHP Code:
function items_trinket($item$adopt){
  
$mysidia Registry::get("mysidia");
$slot1 $this->adopt->getAdoptSlot1();
$slot2 $this->adopt->getAdoptSlot2();
$slot3 $this->adopt->getAdoptSlot3();
$slot4 $this->adopt->getAdoptSlot4();
$slot5 $this->adopt->getAdoptSlot5();
$message <input type=’radio’ name=’slot[ ]’ value=’slot1’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot1}.png'></span><br>
<
input type=’radio’ name=’slot[ ]’ value=’slot2’ /><span class=’slot’><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot2}.png'></span><br>
<
input type=’radio’ name=’slot[ ]’ value=’slot3’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot3}.png'></span><br>
<
input type=’radio’ name=’slot[ ]’ value=’slot4’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot4}.png'></span><br>
<
input type=’radio’ name=’slot[ ]’ value=’slot5’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot5}.png'></span><br>
<
input type=’submit’ name=’choose’ value=’Give Trinket to Adoptable’ />;
return 
$message;
if (!isset(
$_POST[‘slot’])) {
$noslot “You have not selected a slot to place this trinket in.
return $noslot;
}
else {
$slot $_POST[‘slot’];
$image $item->itemname;
$note "The trinket has been given to this adoptable!";
  
$mysidia->db->update("owned_adoptables", array("lastbred" => 0), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
  
$delitem $item->remove(); 
  return 
$note;

The item is supposed to give a user an option of 5 slots to put a trinket into after they selected an adopt to give the trinket to. Is there anything that needs to be fixed/added. All other files have been updated as necesary. Thanks! :D
__________________
Reply With Quote
  #2  
Old 07-03-2014, 03:42 PM
squiggler's Avatar
squiggler squiggler is offline
Squiggling since 1995
 
Join Date: Jul 2013
Posts: 185
Gender: Unknown/Other
Credits: 8,220
squiggler is on a distinguished road
Default

What about that reward/toy mod that was recently posted? Isn't that the same thing? *I know nothing*
__________________
Avatar courtesy of Doll Divine.
Reply With Quote
  #3  
Old 07-03-2014, 04:45 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,855
Hwona is on a distinguished road
Default

^It is, this is my edit on it. I wanted to make it so that you can choose what slot to put it in.
__________________
Reply With Quote
  #4  
Old 07-03-2014, 09:36 PM
squiggler's Avatar
squiggler squiggler is offline
Squiggling since 1995
 
Join Date: Jul 2013
Posts: 185
Gender: Unknown/Other
Credits: 8,220
squiggler is on a distinguished road
Default

Ah. What would the slots be for? Just organization?
__________________
Avatar courtesy of Doll Divine.
Reply With Quote
  #5  
Old 07-03-2014, 09:46 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,855
Hwona is on a distinguished road
Default

Umm, with the current system, you can have several slots, but each specific type of item can only be put in one slot. For example, when you use an item, you don't have the choice of which slot to put it in. :3
__________________
Reply With Quote
  #6  
Old 07-04-2014, 05:22 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,396
IntoRain is on a distinguished road
Default

Don't really know what you want to do, but that return message will stop your function from doing anything after it. Rest looks functional I think xD Great mods btw :3
__________________


asp.net stole my soul.
Reply With Quote
  #7  
Old 07-04-2014, 10:44 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,855
Hwona is on a distinguished road
Default

^Thanks! Is there an alternative to the "return"... function? :3
__________________
Reply With Quote
  #8  
Old 07-04-2014, 02:37 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,396
IntoRain is on a distinguished road
Default

What did you want to do with return? xD A function returns when it ends, consider it the final result of a math problem. And it's other functions that pick up the return from other functions and work with the values
__________________


asp.net stole my soul.
Reply With Quote
  #9  
Old 07-04-2014, 02:50 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,666
Kyttias is on a distinguished road
Default

Having a return at the end like that basically means that calling items_trinket() will result in the value of $note, and will never run again because it is no longer a function holding formula to run/posing a question, it is a function holding an answer? I think. I'm sleepy.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #10  
Old 07-04-2014, 02:53 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,396
IntoRain is on a distinguished road
Default

A function runs as many times as you call it. Even if you return from it, if you call it again it will return again. The problem is the

return $message;

In the middle. At that moment, the function will quit and the rest of code inside that function won't run at all. This part is like it doesn't exist:



PHP Code:
if (!isset($_POST[&#8216;slot’])) { 
$noslot = &#8220;You have not selected a slot to place this trinket in.” 
return $noslot

else { 
$slot $_POST[&#8216;slot’]; 
$image $item->itemname
$note "The trinket has been given to this adoptable!"
  
$mysidia->db->update("owned_adoptables", array("lastbred" => 0), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); 
  
$delitem $item->remove();  
  return 
$note

__________________


asp.net stole my soul.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trinket Images Hwona Art Gallery 3 07-03-2014 10:44 PM
Are there ani guides for making a theme here? Rovick Questions and Supports 13 11-22-2013 04:47 PM
Making IDs be codes? Empress_Swanbottom Questions and Supports 6 02-16-2013 01:24 PM
Making an RSS Feed! PTGigi Tutorials and Tips 1 06-01-2012 03:31 AM
Making a map... help! dulop Questions and Supports 5 05-23-2012 08:14 PM


All times are GMT -5. The time now is 12:57 AM.

Currently Active Users: 3916 (0 members and 3916 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636