Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Making a Trinket System (http://www.mysidiaadoptables.com/forum/showthread.php?t=4580)

Hwona 07-04-2014 03:50 PM

^I want the code to display some radio buttons that will allow a user to actually choose to spot to put a trinket in instead of having the trinket go to the only slot the trinket type was set to go to.(Hope that made sense) The user would then click a radio button to select the slot, and then the rest of the code would put the trinket there and show this message: The trinket has been added. :3 Would adding a "comment" instead work?

Hwona 07-04-2014 06:52 PM

Hmmm... would this code work?:
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 = &#8220;<input type=’radio’ name=’slot[ ]’ value=’slot1’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot1}.png'></span><br>
<input type=&#8217;radio’ name=’slot[ ]’ value=’slot2’ /><span class=’slot’><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot2}.png'></span><br>
<input type=&#8217;radio’ name=’slot[ ]’ value=’slot3’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot3}.png'></span><br>
<input type=&#8217;radio’ name=’slot[ ]’ value=’slot4’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot4}.png'></span><br>
<input type=&#8217;radio’ name=’slot[ ]’ value=’slot5’ /><span class=’slot’><img src='{$mysidia->path->getAbsolute()}picuploads/trinkets/{$slot5}.png'></span><br>
<input type=&#8217;submit’ name=’choose’ value=’Give Trinket to Adoptable’ />”;
$document->add(new Comment($message));
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;


*crosses fingers*

Hwona 07-10-2014 05:48 PM

Ok, I tested out this code:
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’ />"
;
$document->add(new Comment($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('{$slot}' => '{$image}'), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
  
$delitem $item->remove(); 
  return 
$note;


and got this error on a blank page when I tried to use the item:
Parse error: syntax error, unexpected end of file in /home/wallie12/public_html/functions/functions_items.php on line 391
I'm pretty certain the code above is the issue, but I don't know what's wrong. :L

Kyttias 07-10-2014 05:55 PM

You need a closing bracket, I think. You closed the else, but not the function itself.

Hwona 07-10-2014 06:11 PM

Thanks! The page is no longer broken, but now this message pops up:
The item function is invalid. I already modified the privateitem.php file...


All times are GMT -5. The time now is 09:22 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.