@Glitch: I actually downloaded it as well, but since like you I couldn't find anything special by just playing it, I got stuck at that point, as RMXP is still nonexistant on my PC
@thirty: Since Glitch already pointed out the uselessness of the script, let me tell you how to chop the line count a bit... Line 1, for example, is completely uncalled for... trust us on that.
Wrapping the thing in a new class called Gold (and later assigning it to a global variable) is not only the harshest thing you could've done to me to wake me up right now, but also completely unnecessary. Here is what you should have done instead:
class Game_Party
def do_gold
# code
end
end
This gets initialized by default, no need to explicitly call it, AND you can directly access your variables (like
$game_party.gold -->
@gold). Global variables are often an idicator where stuff really belongs to - if you have to call a variable from $game_party, it's likely that the whole method is Game_Party related - therefore, shove it in there in the first place.
What else is there... oh, one of my favourites: Method names. do_gold must be the shittiest method name I've seen in my life, along with make_effect and stash_stuff (which are made-up as well). If anything, you'd call it something along the lines of manage_gold, or change_gold_amount - yes, longer, but also a lot better understandable.
Your possibilities for operation are also kind of wonky... actually took me a few to realize what you're doing there at all, to find out that they really should be named 'add', 'subtract' and 'set'. I'd also recommend wrapping the conditionals for that into a case, like so:
case operation
when 'add'
# do stuff
when 'subtract'
# do stuff
when 'set'
# do stuff
end
Now to the actual stuff you do upon deciding on the operation mode... setting an instance variable to the value of the local variable seems really strange - after all, you're staying inside the very same method all this time... same thing for $game_party.gold, which is actually very unnecessary to assign to another variable anyway, as you can access it from everywhere likewise.
As explaining you how to shorten that is a bit stressful, let me just show you how your script could've looked like if you followed all of my suggestions here:
[rgss]class Game_Party
def manage_gold(amount, operation = 'add')
case operation
when 'add'
$game_party.gold += [[amount, 9999999].min, 0].max
when 'subtract'
$game_party.gold -= [[amount, 9999999].min, 0].max
when 'set'
$game_party.gold = [[amount, 9999999].min, 0].max
end
end
end
[/rgss]
You can see I took the liberty and fixed the flaw of your script that allowed to set the gold to negative values... while decreasing the line count by another couple of lines on that.
Now here comes the fun part: All you have to do to do this completely without your script is create a Call Script, and if you want to increase the gold, copypaste the line that's under when 'add', so your Call Script looks like this:
$game_party.gold += [[amount, 9999999].min, 0].max
Credit me when you use this. :shades: