I'm trying to write a script that reduces the player's total money by 10%. I tried the script below but it doesn't work because I can't use floating point variables. How do I make this happen?
plotscript, paragon, begin
set money (party money * 0.90)
end
Could do something like:
plotscript, paragon, begin
setmoney (partymoney--(partymoney/10))
end
I'm not 100% that will perform the order of operations correctly. If not, do something like this:
plotscript, paragon, begin
variable(10pctmoney)
10pctmoney:=(partymoney/10)
setmoney(partymoney--10pctmoney)
end
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
plotscript, paragon, begin
setmoney (partymoney--(partymoney/10))
end
I'm not 100% that will perform the order of operations correctly. If not, do something like this:
plotscript, paragon, begin
variable(10pctmoney)
10pctmoney:=(partymoney/10)
setmoney(partymoney--10pctmoney)
end
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
By the way, a general method for dealing with percentages in Hamsterspeak that I've used over the years is to work with some variation of "divide by 100 (to get 1 percent), then multiply by the desired percentage". It isn't exact, so it's only useful for some applications where 100% accuracy isn't important, but it generally works:
For instance, you could get 73% money (or some unusual percentage) by that method:
32,742 gold * .73 = 23,901.66 = 23,902
32,742 gold / 100 = 327.42; 327 * 73 = 23,871
Difference of 31 gold, not a terribly significant amount of the total.
I am quite certain, tho, that someone on here will know of a better method than this.
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
For instance, you could get 73% money (or some unusual percentage) by that method:
32,742 gold * .73 = 23,901.66 = 23,902
32,742 gold / 100 = 327.42; 327 * 73 = 23,871
Difference of 31 gold, not a terribly significant amount of the total.
I am quite certain, tho, that someone on here will know of a better method than this.
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
What'd I tell ya?
<-- had to stay up really really late in order to get good grades in math classes ;_;
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
<-- had to stay up really really late in order to get good grades in math classes ;_;
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!



