[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Save data issue for Aardwolf
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Save data issue for Aardwolf

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Trepid   (2 posts)  [Biography] bio
Date Fri 24 Apr 2015 02:26 AM (UTC)
I apologize for the long post, but it is somewhat of a complicated issue for me. I am building an area in Aardwolf, and within my area I am trying to get a game called "bones" work properly. Here is the information on the game:

There are 10 chests, and each chest has a different starting amount of prize gold in it :

chest # Starting amount

chest 1 10,000
chest 2 25,000
chest 3 50,000
chest 4 100,000
chest 5 250,000
chest 6 500,000
chest 7 1,000,000
chest 8 2,500,000
Chest 9 5,000,000
Chest 10 10,000,000

Your gold buy-in is 1,000,000, and you can only play once a day.

Your gold is dispersed across the chests

chest 1 (2%) 10,000 + 20,000 = 30,000
chest 2 (4%) 25,000 + 40,000 = 65,000
chest 3 (6%) 50,000 + 60,000 = 110,000
chest 4 (8%) 100,000 + 80,000 = 180,000
chest 5 (8%) 250,000 + 80,000 = 330,000
chest 6 (10%) 500,000 + 100,000 = 600,000
chest 7 (12%) 1,000,000 + 120,000 = 1,120,000
chest 8 (14%) 2,500,000 + 140,000 = 3,640,000
chest 9 (16%) 5,000,000 + 160,000 = 5,160,000
chest 10 (20%) 10,000,000 + 200,000 = 10,200,000

How the game works:

After you buy-in and your money is dispersed into the chests, you are given a bone by the mob to throw on a large stone in the room. As you throw the bone on the stone, it shatters into a large amount of pieces. The mob counts the number of pieces, and the number of shattered pieces equals your score. 1-10 pieces would mean chest 1, 11-20 pieces chest 2, and the same all the way up to chest 10.

Your chances for winning the chests would be the reverse percentages as your buy-in money disbursement:

chest 1 (20% chance to win) 30,000
chest 2 (16% chance to win) 65,000
chest 3 (14% chance to win) 110,000
chest 4 (12% chance to win) 180,000
chest 5 (10% chance to win) 330,000
chest 6 (8% chance to win) 600,000
chest 7 (8% chance to win) 1,120,000
chest 8 (6% chance to win) 3,640,000
chest 9 (4% chance to win) 5,160,000
chest 10 (2% chance to win) 10,200,000

If no winners hit the prize money for that chest, the total would stay in that chest for the next game. The chest that the winner takes from starts the prize money for that chest over. For example, if you won chest 9 , you would win that money, and chest 9 would start over at 5 million for next game. If no one won the 1,140,000 in chest 8 that prize money would stay. The gold amounts would stay until either someone wins it.

So somehow I need to come up with a way to savedata on the amount of gold in each chest. I assume the only way to do this is with a table? I am having a hard time understanding how I would write this into script.

Is there another way to save data other than with a table?
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] bio
Date Reply #1 on Fri 24 Apr 2015 03:59 AM (UTC)
First, you're going to need a LOT of data carryover and may need to modify the copyover process if you want a fully persistent value on the chests between games/days. You're also going to need to track which characters have played somehow, be it a new char variable (safer for copyover) or a tracking token created by the mob running the game.

That said, I'd start your testing with a single chest to get the bugs worked out and come back with code as you progress and run into issues. Also, my personal advice would be to simply bleed off any gold that went to chests that aren't winners every game rather than trying to retain the increases until someone wins.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
[Go to top] top

Posted by Trepid   (2 posts)  [Biography] bio
Date Reply #2 on Fri 24 Apr 2015 03:07 PM (UTC)

Amended on Fri 24 Apr 2015 11:18 PM (UTC) by Trepid

[Go to top] top

Posted by Fiendish   USA  (1,744 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Fri 24 Apr 2015 08:23 PM (UTC)
I think asking on the Aardwolf build/test port makes more sense than asking here.

[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]