@FairyGodfeather
interesting idea, it would simplify it in the aspect of shopping. but I am not quite sure how to do a temp. conversion for the display in stats.
Several games use currency, but I haven’t seen any that uses it in multiple levels. the ones I have seen all use “Gold”, as the only one, which is quite simple to do.
However, I feel that I can add more depth to the currency system with it being in both gold and silver.
I will try to look into the whole *temp thing, it does sound very promising, and something I hadn’t thought of myself.
Thank you for the input, and if you have any ideas on how to do it, it would be much appreciated.
I’d think using silver as the only real variable is really simplifying you’re job for currency, without devaluing your gold & silver depth. Plus, you’re using base 10, so it’s simple enough to do, I believe.
Your regulater (sic) is pretty good, and you can retool it to simplify coding.
E.G.
choicescript_stats.txt
*temp gold
*label wealth_regulator
*if silver>99
*set silver - 100
*set gold + 1
*goto wealth_regulator
*comment
*if silver<100
*goto finished
*comment Sorry about this bit of code. Vanilla forums hates us all equally.
*label finished
*comment Since you're using levels of currency, I'd recommend opting out of a stat chart for currency - it looks a little funny in my head.
Gold: ${gold} Silver: ${silver}
*comment Side by side makes sense to me, as opposed to Gold on one line, and Silver on the one beneath it. They serve the same purpose, why be on separate lines.
Shop Idea?
*set silver 150
"Lookin' to buy iron or steel?"
*choice
*selectable_if (silver>50) #Iron Sword - 50 Silver
The man takes 50 of silver coin.
You receive an Iron Sword in return.
*set silver - 50
*selectable_if (silver>150) #Steel Sword - 1 Gold and 50 Silver
You give the man a gold coin and 50 of it's silver cousins.
He gives you a Steel sword in return.
*set silver - 150
*comment Players should believe that it's taken away 1 Gold and 50 Silver, but really it's taken away just 150 silver. The wealth_regulator will still show that it's taken 1 Gold though.
#Nevermind. I should save my coin.
You decide to leave empty-handed, but purse-full.
For future reference, try not to double-post while your Edit button is available and if you’d prefer to type out codeboxes, use the tags < pre > and < /pre >, removing the spaces.
I may have overlooked some stuff, but I would of put mine in the choicescript_stats but everytime someone got money in the game I would copy and paste the converting part over, so it doesnt have any errors.
“You can also use the modulo operator “%” to calculate the remainder after taking a division. Modulo is pretty weird, but it’s has two particularly interesting uses. First, you can check whether a number X is evenly divisible by a number Y by checking whether X % Y = 0. Second, you can use it to get the fractional part of a number X, the stuff that comes after the decimal point, by calculating X % 1. For example, 3.14 % 1 = 0.14.”
@CJW could you provide an example of how that can be used? It’s melting my brain currently looking at it. How could you use it in the example to convert gold into silver?
@FairyGodfeather, I tried to figure it out, too. All I could get out of it was that, if you have 563 silver, you could *set silver % 100 and it would end up being 63 silver. I don’t know how to translate that removed 500 into 5 gold.
@Caddmuss I already read that. Actually I read it when I was trying to work out how best to help earlier but I couldn’t make head nor tail of it. My brain’s being math stupid today.
Ooh, I just figured out a random idea for this if you’re doing the multi-level currency!
Whilst traveling through the wood, a band of thieves emerge from the brush.
"Hand over your coin purse, or die."
No way to defend yourself, you toss over the small pouch of currency.
The leader pockets all your gold before tossing you pack a still partly filled sack.
"Have a drink on me when you get out of the forest," he smirks.
*set silver % 100
It’s just off the top of my head, but at least I can think of a use for modulo operations now.
Um. Not sure if this is precisely right. I was fiddling with the tester though and it kind of seems to work.
In this case I’m using wealth as the variable for how much money you have. It’s in silver. I’m using the silver and gold variables just to display to the player how much cash they have and calculating it off their wealth stat.
I have a 8 slot inventory coded but it’s pretty advanced but ill post it for you.
\*create pocketspace
\*set pocketspace 0
\*create backpackspace
\*set backpackspace 0
\*label inventory
\*line_break
\*if (backpackslot1 != "Empty")
\*set pocketspace + 1
\*if (backpackslot2 != "Empty")
\*set pocketspace + 1
\*if (backpackslot3 != "Empty")
\*set backpackspace + 1
\*if (backpackslot4 != "Empty")
\*set backpackspace + 1
\*if (backpackslot5 != "Empty")
\*set backpackspace + 1
\*if (backpackslot6 != "Empty")
\*set backpackspace + 1
\*if (backpackslot7 != "Empty")
\*set backpackspace + 1
\*if (backpackslot8 != "Empty")
\*set backpackspace + 1
\*line_break
\*if ((backpack) and ((pocketspace = 0) and (backpackspace = 0)))
You do not carry anything with you.
\*fake_choice
#Go Back
\*goto_scene choicescript_stats
\*if (backpack) and (pocketspace >= 1)
----------Pocket----------
\*line_break
Pocket Space: ${pocketspace}/2
\*if (backpack) and (backpackspace >= 1)
----------Backpack----------
\*line_break
Backpack Space: ${backpackspace}/6
\*if (pocketspace > 0)
\*fake_choice
\*if (backpackslot1 != "Empty")
#${backpackslot1}
You open up your pack to grab your ${backpackslot1}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot1 = "Meal")
#Eat ${backpackslot1}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot1 "Empty"
\*goto display
#Discard ${backpackslot1}
\*set backpackslot1 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot2 != "Empty")
#${backpackslot2}
You open up your pack to grab your ${backpackslot2}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot2 = "Meal")
#Eat ${backpackslot2}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot2 "Empty"
\*goto display
#Discard ${backpackslot2}
\*set backpackslot2 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot3 != "Empty")
#${backpackslot3}
You open up your pack to grab your ${backpackslot3}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot3 = "Meal")
#Eat ${backpackslot3}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot3 "Empty"
\*goto display
#Discard ${backpackslot3}
\*set backpackslot3 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot4 != "Empty") and (age >= 11)
#${backpackslot4}
You open up your pack to grab your ${backpackslot4}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot4 = "Meal")
#Eat ${backpackslot4}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot4 "Empty"
\*goto display
#Discard ${backpackslot4}
\*set backpackslot4 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot5 != "Empty") and (age >= 11)
#${backpackslot5}
You open up your pack to grab your ${backpackslot5}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot5 = "Meal")
#Eat ${backpackslot5}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot5 "Empty"
\*goto display
#Discard ${backpackslot5}
\*set backpackslot5 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot6 != "Empty") and (age >= 11)
#${backpackslot6}
You open up your pack to grab your ${backpackslot6}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot6 = "Meal")
#Eat ${backpackslot6}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot6 "Empty"
\*goto display
#Discard ${backpackslot6}
\*set backpackslot6 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot7 != "Empty") and (age >= 11)
#${backpackslot7}
You open up your pack to grab your ${backpackslot7}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot7 = "Meal")
#Eat ${backpackslot7}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot7 "Empty"
\*goto display
#Discard ${backpackslot7}
\*set backpackslot7 "Empty"
\*goto display
#Back
\*goto display
\*if (backpackslot8 != "Empty") and (age >= 11)
#${backpackslot8}
You open up your pack to grab your ${backpackslot8}...
Now the question is what to do with it?
\*fake_choice
\*if (backpackslot8 = "Meal")
#Eat ${backpackslot8}
\*if (hunger = 0)
Your not hungry!
\*goto display
\*if (hunger >= 1)
\*set hunger - 1
\*set backpackslot8 "Empty"
\*goto display
#Discard ${backpackslot8}
\*set backpackslot8 "Empty"
\*goto display
#Back
\*goto display
You probably don’t really need to understand it, but those *set four lines will basically convert any excess bronze coins (over 99) into silvers, and excess silvers into gold.
The other lines are just variable definitions and a quick display, for example purposes.
In that example it’ll turn:
Gold: 1
Silver: 1523
Bronze: 112
into
Gold: 16
Silver: 24
Bronze: 12
Copy and paste all that into here, if you want to see it working.
You basically just slap those four lines in anytime you want to sort ‘top-heavy’ currencies.