How to change the currency for a buyable purchase

Please, help. I’m stuck when changing the currency. I check docs, but found nothing

1 Like

Here’s an example used in an buyable (that I use for different currencies)

11: {
title: “Buyable Example”,
unlocked() { return true },
cost(x) {
let exp1 = new Decimal(1.2)
let exp2 = new Decimal (1.1005)
return new Decimal(2).mul(Decimal.pow(exp1, x)).mul(Decimal.pow(x , Decimal.pow(exp2 , x)))).floor()
},
display() {
return “Cost: " + format(tmp[this.layer].buyables[this.id].cost) + " A-Points” + "
Bought: " + getBuyableAmount(this.layer, this.id) + “
Effect: Nothing” + format(buyableEffect(this.layer, this.id))
},
canAfford() {
return player.A.points.gte(this.cost())
},
buy() {
let cost = new Decimal (1)
player.A.points = player.A.points.sub(this.cost().mul(cost))
setBuyableAmount(this.layer, this.id, getBuyableAmount(this.layer, this.id).add(1))
},
effect(x) {
let base1 = new Decimal(1.46)
let base2 = x
let expo = new Decimal(1.012)
let eff = base1.pow(Decimal.pow(base2, expo)).times(buyableEffect(‘mE’, 14).pow(0.2))
return eff
},
},

Not sure if it works since I wrote it in here instead of VSCode.

[Change Buy() & canAfford() to your conditions of currency :)] (Same with everything else in here)