#21
|
||||
|
||||
re
Uh oh, I'm a bummer - can someone show me an example or the location of the source codes? :(
|
#22
|
||||
|
||||
Hall Of Famer means the function you made, the whole code from the file
Btw you have the if still liek this? if($gender = 'f') It should be if($gender == 'f') = means you are giving the variable a value. == means you are comparing it (it's a function that says if it is false or true) Btw if you already have the switch-case you can take the if off. Like PHP Code:
Last edited by IntoRain; 08-20-2013 at 11:41 PM. |
#23
|
||||
|
||||
Re
Oh, it has to be 2 equal signs - I'll try that! Thanks for the tip. :3
Edit: Thanks, you fixed half of my problem! The item says "action completed" and gets deleted, but my male adoptable is still male, and the "gender change successful messge" does not pop up. :L Also, here's the code: PHP Code:
Last edited by Hwona; 08-21-2013 at 08:06 AM. |
#24
|
||||
|
||||
I simulated what you wanted to do and it's working, I used only if's instead switch-cases (not to mix if's and switch-cases since they both do the same):
PHP Code:
PHP Code:
Also, the item deletes anyway at the end because it's not inside the the case. You have to delete the item if it succeeds, so it should be inside the case. Also each case must end with break; so it knows when to stop. Since your adopt was male, it was reaching the switch-case (the else). But it would only activate if it was female, so it ignored it and proceeded to item deletion so that's why it was decreasing and not changing the gender. To avoid this kind of confusion, you only delete the item if the switch-case is sucessful. With your own code: PHP Code:
Last edited by IntoRain; 08-21-2013 at 05:15 PM. Reason: removed part of text |
#25
|
||||
|
||||
I guess my post was a bit misleading, I was merely referring to the source code of the very item function you created, not the source code of the entire functions_items.php file. For this case it is not a problem, but at some circumstances it may be time consuming to read through an entire script file. Id say just post the code that aint working is sufficient when bringing up a problem.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#26
|
||||
|
||||
Re
Ah. I see! xP
Well, in that case, here's the code! :D PHP Code:
Here's the finished code :D: PHP Code:
Last edited by Hwona; 08-21-2013 at 04:48 PM. |
#27
|
||||
|
||||
I already explained why it wasn't working, see the post above Hall Of Famer's. Your switch case is wrong
case "f": .... ^ The switch-case only does the code (update thingy) you have after it if your adopt's gender is female. So it will only change the gender from female to female. You need to change it to case "m". Last edited by IntoRain; 08-21-2013 at 05:12 PM. |
#28
|
||||
|
||||
Yeah, I edited my last post. Anyways, thank you so much! I probably would have kept changing the code and fixing nothing if you didn't point that out. >^.^<
|
#29
|
||||
|
||||
Yay that's great! :D
|
#30
|
|||
|
|||
Sorry to bump up this thread, but I was seeing if I could try out this mod (and then do one similar for color/marking changing) and have been running into the same item function invalid error. I'm using 1.3.4, so I'm not sure if maybe that's the issue or not or if I've run into an error with my itemfunctions table in general (I assume that the intent is for adoptable, but I may have done it wrong) . ^v^;
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with a item function | kristhasirah | Questions and Supports | 35 | 04-03-2017 10:17 AM |
Mys v1.3.4 Item Function: Gender Change Potion | Kyttias | Mys v1.3.x Mods | 21 | 10-12-2016 07:52 PM |
Calling a function in a function from the same class page | Hwona | Questions and Supports | 2 | 04-25-2015 08:41 AM |
Item Function Suggestions | NobodysHero | Suggestions and Feature Requests | 5 | 06-23-2014 03:45 AM |
What's New? |
What's Hot? |
What's Popular? |