Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Secondary currency questions
So, I think I've done pretty well with creating a secondary currency, but I'm still having a few issues.
First off, I can get the currency to display in the sidebar and drop when I level up an adoptable, but it drops at the same rate as the main currency, even though (I thought) I set it to drop at a lower rate. I also can't get the currency to be differentiated in the shops. For example, I want a shop to only take once currency and another that takes the other. I'm wondering where in the script I can go to edit these things (and prefferably un-link the two currencies so that they are independent of each other - When I went to test buy an item, it displayed that I only spent the one currency but both currencies decreased by the same amount). Eventually, I'll want three currencies (one that can be purchased for RL money), but I need to fix these issues before I do anything with that. Hopefully I'm making sense! |
#2
|
|||
|
|||
bumping this up. ^v^;
|
#3
|
||||
|
||||
Let me think... first, I would make a column in the shops table of the database to tell which shops which currency to use. Then, I would have to add a variable representing this new column at the top of classes/class_itemshop.php and classes/class_adoptshop.php. Next, in the same files, I would have to modify the public function purchase and check which currency the shop is using and reduce only the currency that shop is using. (It would be much harder to make a shop that utilizes both currencies at once, and even harder to have it so the same item can be bought with either. So let's just not go down that road right now, as it would involve making columns in the items table, then running running some sort of check or another when display the item buy form...)
As for the drop rate - the amount of currency dropped when visiting a pet is determined by the value column on the reward row of table levels_settings in the database. I would suggest making another row for your other currency to determine the drop rate for it. You'll need to reference to it in classes/class_levelsetting.php by creating a variable for it at the top. In the public function __construct, imitate what's going on with $this->reward with the name of your new variable. In levelup.php, at the end of public function click, imitate what's going on here for the original currency's $reward, one line at a time, each after the last. And finally, in view/levelupview.php, after $reward variable is set, do so with your second, new one as well. I think that's all you should need to do. I hope that's enough hints. ^^
__________________
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. Last edited by Kyttias; 12-15-2014 at 01:21 AM. |
#4
|
|||
|
|||
Thanks so much! When adding the currency options in the shop table, is it an INT type or something else? I'm going to play around with it, but I'm excited!
|
#5
|
||||
|
||||
INT is short for Integer values. Integer is a mathematical term and is just a fancy word for numbers. VARCHAR is short for Variable Character values, and can hold both numbers and letters. I'd go for VARCHAR with a length of 10 or so, unless your currency names are longer than 10 letters.
__________________
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. |
#6
|
|||
|
|||
Ok!
Also, how do I write the code to check which currency to use? I tried a couple of things that I thought would work (like a switch case) and failed (I'm a noob). Other than that, everything else seems to be working and easy! |
#7
|
||||
|
||||
What are:
I was thinking it'd be something vaguely like this? public function purchase(Item $item){
__________________
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. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Second Currency and Currency icon | Rovick | Suggestions and Feature Requests | 14 | 11-11-2014 05:29 PM |
Secondary "RARE" cash option? | Tequila | Questions and Supports | 4 | 09-17-2012 09:18 AM |
secondary cash.. | maximillion | Questions and Supports | 2 | 07-04-2011 09:42 PM |
Mod: Currency | Magnie | Addons/Mods Graveyard | 12 | 06-05-2010 10:05 AM |
Currency Mod | Killgore | Questions and Supports | 1 | 04-10-2009 08:04 PM |
What's New? |
What's Hot? |
What's Popular? |