[Modpack] Slot machine mini-games [git][minislots_modpack]

Post Reply
User avatar
VanessaE
Member
Posts: 4656
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

[Modpack] Slot machine mini-games [git][minislots_modpack]

by VanessaE » Post

Slot Machines mini-games engine

Image

This package provides a simple "engine" to drive slimmed-down slot machines. It takes-in and pays-out in Minegeld, the money from Dan's currency mod, spins reels, awards wins, and so forth.

It features wild cards, variable matching, multiple pay lines, and scatter wins and bonus rounds (though that one's only just barely implemented right now). It even "prints" a mock cashout voucher like the kind commonly used in a casino (though the engine just puts the money in your inventory -- I may make it give you a voucher item to be redeemed at a separate machine in the future, as in a real casino).

Machines are fully themeable, from the biggest parts of the UI graphics to the smallest details of the labels and numerals. Most of the important UI elements' sizes and positions can be controlled.

Each slot machine is completely self-contained with its own running balance and behavior.

In-game displays and animations are created by abusing the crap out of Minetest's formspecs. :-)

Two example machines named "Golden 7's" and "Golden 7's Deluxe" are included. Yes, I know the pay tables suck.

The hope is that others will take this and run with it, perhaps fine-tuning the example machines or using them and the graphics work files to create more machines, either as new machines to be included in the modpack, or as external mods/modpacks.

No craft recipes yet, but then again I'm not entirely sure a mod like this needs 'em.

Download: https://github.com/mt-mods/minislots/ar ... master.zip
...or browse the code: https://github.com/mt-mods/minislots

Depends: Minetest 0.4.17.1 or 5.0.0-dev, corresponding minetest_game, currency (my fork, which has 50 Mg notes).

License: LGPL 3.0 for code and CC-by-SA 4.0 for media and everything else.
Spoiler
Image
The outside/cabinet graphics for the 3-reel demo machine

Image
The in-game display of that machine, showing the result of a 9-line, bet-1 spin
Note: The graphics work files are in a folder in the top level of the modpack. Minetest might see that folder as a mod, but it isn't. Try to "enable" it and nothing will come of it.
Attachments
Screenshot_2018-09-11_16-50-55.png
Screenshot_2018-09-11_16-50-55.png (134.05 KiB) Viewed 2965 times
Screenshot_2018-09-11_16-46-25.png
Screenshot_2018-09-11_16-46-25.png (833.84 KiB) Viewed 2965 times
Screenshot_2018-09-11_16-47-21.png
Screenshot_2018-09-11_16-47-21.png (775.62 KiB) Viewed 2965 times
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Blu5
New member
Posts: 8
Joined: Wed Mar 08, 2017 00:42
IRC: Blu5
In-game: Blu

Re: [Modpack] Slot machine mini-games [git][minislots_modpac

by Blu5 » Post

Whoa! That seems fascinating! I might use that in my singleplayer world!

User avatar
SaKeL
Member
Posts: 749
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Modpack] Slot machine mini-games [git][minislots_modpac

by SaKeL » Post

Nice..was looking for something like this..still looking for black jack and others :) thanks for the great work!

fg1
New member
Posts: 5
Joined: Sat Jan 04, 2025 10:20

Re: [Modpack] Slot machine mini-games [git][minislots_modpack]

by fg1 » Post

Any ideas how to make it work with other luanti versions, 5.10 for instance?
Is it the difference in formspec or what, players can only bet 1 mg on 1 line, at some point in the past i managed to bet on a few lines, but it was a fluke

elschemm
New member
Posts: 3
Joined: Tue Sep 23, 2025 17:10

Re: [Modpack] Slot machine mini-games [git][minislots_modpack]

by elschemm » Post

fg1 wrote:
Sat Jan 11, 2025 12:26
Any ideas how to make it work with other luanti versions, 5.10 for instance?
Is it the difference in formspec or what, players can only bet 1 mg on 1 line, at some point in the past i managed to bet on a few lines, but it was a fluke
Hello. I have just run across the same thing after migrating from Luanti 5.4 to 5.12. This may or may not solve problems for 5.10, but the solution is likely similar.

Note: I am not the original author of the code, just posting a patch that works for me. I have also modified the code slightly so, I can't give exact line numbers for the original version.

It appears the error comes from some slight changes to minetest.serialize at some point, this causes the positions in allfields to be off a bit, and the tonumber to fail to the backup state of 1 when it does.

In the engine.lua file, you will need to find the line that block of code that starts:

Code: Select all

      elseif string.find(allfields, "bet_") then
	local s1 = string.sub(allfields, 15)
	local s2 = string.find(s1, '"')
	local linebet = tonumber(string.sub(s1, 1, s2-1)) or 1
You will need to change the 15 to a 13, and the s2-1 to an s2-2 so that it looks like this:

Code: Select all

      elseif string.find(allfields, "bet_") then
	local s1 = string.sub(allfields, 13)
	local s2 = string.find(s1, '"')
	local linebet = tonumber(string.sub(s1, 1, s2-2)) or 1




The next block of code you need to change looks like (about 40 lines further down):

Code: Select all

      elseif string.find(allfields, "lines_") then
        local s1 = string.sub(allfields, 17)
        local s2 = string.find(s1, '"')
        local maxlines = tonumber(string.sub(s1, 1, s2-1)) or 1
You will need to change the 17 to a 15, and again change the s2-1 to an s2-2 so that it looks like this:

Code: Select all

      elseif string.find(allfields, "lines_") then
        local s1 = string.sub(allfields, 15)
        local s2 = string.find(s1, '"')
        local maxlines = tonumber(string.sub(s1, 1, s2-2)) or 1
Making those two changes seems to fix the problem for me. The first changeset allows for betting more than 1mg, and the second changeset fixes it to allow for more than one line.

Good Luck.
Schemm

Post Reply

Who is online

Users browsing this forum: MXB and 1 guest