Ambition - Creating an MMG Script for KoLMafia

abr71310

New member
I remember that someone created an MMG Bot for 10.0, but I tried it, and it never looped or chained correctly (or worked the way it was supposed to -- always crashed after one script)...

Now I'm just asking for some general tips/advice as to how to access specific functions of KoL Mafia (that is, automatically referencing and finding Seaside Town --> Wrong Side of the Tracks --> The Casino --> Money Making Game)...

First off, some background.
I'm a third-year programmer (senior in high school) that has general knowledge from PLs such as C++, Java and Pascal -- I've done no actual web-based programming but I know the basics of PHP and HTML, to the extent that I can design and edit my own webpages for creativity and "functionality"...

I like to envision ways to do things better - hence, when I heard about KoLMafia, I was immediately interested in finding ways to do specific things (that I do) faster -- that is, do my daily Hobopolis Town Square run (which surprisingly isn't implemented to my liking -- I'll have to redo it), buy and sell clovers + IOTMs/Mr. As/Food/Booze for profit, and play the Money-Making Game (so that I don't have to keep clicking all day long and instead can enjoy the time on Chat talking business with my clan mates and friends).

Here's my MMG plan, for starters (I'll come back and help with redesigning a better combat system, but as I said before, I'm a total scripting noob, so I'm just getting on board now):

What I plan to do is implement my specialized betting system (it isn't Martingale, but is similar and actually has a 95% success rate at making me money, rather than the 50% 1000meat profit per chain system Martingale employs) -- I've only ever lost 2 24-chains in a row, and in those chains only lost ~5mill meat (I've won much more) to meet specific requests, such as an upper, lower and bank limit (bank being "closet"), as was supposedly implemented in KoLMafia10.0... The profit margin on my system can range based upon the Loss chain -- anywhere from 5000 meat per chain to upwards of 1.5million (I make sure to not "overbet" -- that is multiply the original bet by a ridiculous factor -- obviously, to be implemented, I need a "ceiling" variable and some nested if/for loops/statments).

I also want it to NOT run in the "Run Custom Scripts" section, but rather, as it was in 10.0, have a "Coin Toss Game" option in the Tools menu -- this might require revising a build or implementing new commands to the CLI (does anybody know how to do that? I couldn't find anything on Google or on this forum :S)

If anybody can help me get started, or explain to me how to go abouts implementing my vision, I would definitely appreciate it.

And yes, once I get it running, I'll list it here for free -- since I'm awesome like that. ;)
 

Paragon

Member
I wrote a MMG script once... but it always lost money. I'll try to see if i can dig it up again. If you don't mind me asking whats this system that you are using?
 

abr71310

New member
Well, it's not Martingale, nor is it random.

What it is: Basically, take a normal Standard Deviation chart for any given game of MMG -- Modify it so you're able to "guess" which rounds you'll win, and bet 5x your floor bet to see if it works. 35% of the time it will (and I can prove this using slopes in Calculus -- but I won't, because that would take years of forum pages), the other 65% of the time you will lose. What you do then is up to you -- most players bow out and leave -- these are the noobs that make nothing. I play it smartly, I realize that even after losing 40 times in a row (this HAS happened), there is still that 50/50 I'll win.

Instead of bowing out (normal people on Martingale would have lost 500 billion by now; using my system you lose ~2mill, max), you bet your ceiling slowly.

I guarantee that 99.997% of the time you'll make profit.
I've still yet to lose money on my system, and I've been using it for a long time.

I just wanted to build a script based on my intelligence (that is, be able to recognize when to bet and how much to bet), so that I can chill and talk with friends while I automate my money-making skillz (and so I can run it at night and come back 100 mill richer).

Obviously there's going to be a limit loss -- I'd factor that in after I wrote it, but now I'm starting to wonder if i should even release it when I'm done -- someone's bound to multi-abuse it to make trillions, and I'm not one to help noobs who aren't willing to just use one player to play KoL (I'm no noob, I still have the one account I had from the start).
 

lostcalpolydude

Developer
Staff member
[quote author=abr71310 link=topic=2056.msg10242#msg10242 date=1228550529]buy and sell clovers + IOTMs/Mr. As/Food/Booze for profit[/quote]
This is separate from your main point, but this requires lots of automated mall searches, right? Mafia has specifically designed to not allow scripts to do mall searches and then use the results as inputs for scripts because it would be too easy to run lots of mall searches and create server load.
 

dj_d

Member
With due respect to those who enjoy MMG (and roulette, and blackjack, etc) it amazes me that people do enough research to learn about things like Martingale without noticing that it's mathematically impossible to create a winning strategy for a game where you lose less than 50% of the time. Martingale, recall, is a losing strategy.

If you'd like to share your system, I'm happy to try to pick it apart for you. The likely failure is that - like martingale - you'll win a small amount often, and lose a big amount infrequently (that is slightly bigger than your winnings). If you limit your big losses so they don't get too big, they'll happen more frequently. If you make them happen less often, they'll be bigger.

This is one of those things like perpetual motion machines - it seems possible, and it's almost possible, and you can permute it many ways to convince yourself that you're successful... but it ain't possible.
 

Bale

Minion
[quote author=abr71310 link=topic=2056.msg10248#msg10248 date=1228572885]What it is: Basically, take a normal Standard Deviation chart for any given game of MMG -- Modify it so you're able to "guess" which rounds you'll win,

[...]

I'm starting to wonder if i should even release it when I'm done -- someone's bound to multi-abuse it to make trillions, and I'm not one to help noobs who aren't willing to just use one player to play KoL (I'm no noob, I still have the one account I had from the start).
[/quote]

Oh for cryin' out! The only way it can be abused is if people use it too much because they think they'll make money. If you think you can estimate which round you'll win in, then you aren't playing a game where there is ALWAYS a 50% chance of loss regardless of how many times you win or lose previously.
 

abr71310

New member
Going back to my original topic (Which has seemed to be besides the point...)...

Does anybody know how to write MMG-playing scripts?
Despite what you guys think, my system will work, since I've mathematically proven that even at my highest loss, it would be only 45% of the total winnings up to that point....

So just let me do my thing, or at least be quiet about trying to criticize it so quickly!!!!

-- Can anybody help me use KoL-mafia or another PL to design a program or a script that will run my system (or at least to an extent) during the hours I'm not home??
 

dj_d

Member
This would probably be a good time to point out that your request violates the prime directive, at the top of every page of this forum...

"Remember, you can only get help with a script you've already partially written. Anything else is considered a request, and must adhere to these guidelines. Posts failing to do so will be deleted."
 

abr71310

New member
I never asked for a script, but merely a place to start -- I never even asked for a file...

I just want advice as to how to get started...
But sheesh, if you're going to pick out every part of my forum posts, I'll figure it out on my own, then...

Geez.

Have a good day.
 

Bale

Minion
He was just saying that by the rules you are obligated to show that the script is partially written. For more general help like "how to get started" there's already tons of advice waiting for you to pick them up, like ripe fruit in the autumn. There's no need for you to get offended. Just prove that you're serious about writing this by showing a piece of what you've done. As hola says, "this forum is for 'writings in progress' or 'completed scripts'."
 

zarqon

Well-known member
@abr: A few words which are hopefully helpful.

First, welcome to the mafia scripting community! I hope you enjoy this very valuable resource.

To get you started: you'll want to use the visit_url() command. It takes a URL as a parameter (for accessing pages in Loathing you only need the local URL, i.e. "clan_roster.php" not "http: //www2.kingdomofloathing.com/clan_roster.php") and it returns the text of that page, which can be stored in either a buffer or a string. Any variables appended in the query string (normally sent as GET requests) are automatically converted to POST, enabling you to interact with all the forms everywhere in Loathing.

From there, you can use string-parsing functions such as contains_text() and index_of() to determine your next move.

Also, don't get upset with the peeps here for picking apart your post. We're a community of programmers and that's what we do -- it's nothing personal. If and when you post your finished script, rest assured we will pick that apart too -- in the interest of an optimal script. Inefficiencies will be commented on, and fixes suggested, for all scripts, for all authors.

I understand that you are excited about making your idea a reality and therefore want to get on it as quickly as possible, so you asked for pointers in the right direction rather than going the long way around and researching the language of ASH. But there are no shortcuts -- we will gladly help you solve any obstacles you encounter, but first you have to go down the path as far as the obstacle.

You can avoid many of these obstacles by looking at the work of those who have already passed them. I have written a few scripts that parse URLs (First Things First for example, or you could definitely look at the item-turnin and final battle sections of the One-Click Wossname script) and there are plenty of other scripts around here that contain all of the concepts you'll need to write your script.

Additionally, recommendations for a starting scripter have been given here.

Once you get your script started and post what you have so far, I hope you'll find your reception more friendly. It is unfortunate some people shot down your idea rather than helping you script it -- since if it fails they would be proven right -- but in your eagerness you overlooked the forum policy on requesting nonspecific aid. But if you really care about scripting then don't leave -- this forum is a valuable resource for scripters and shunning it because of a few comments would be your loss.

As for buying and selling items for profit, it is forbidden by mafia's authors to use mafia for that purpose, and for very good reasons, so give up on that right now. As for the MMG script, I wish you success.

Good luck. I look forward to seeing your finished script.
 

Bale

Minion
[quote author=zarqon link=topic=2056.msg10300#msg10300 date=1228780597]
To get you started: you'll want to use the visit_url() command. It takes a URL as a parameter (for accessing pages in Loathing you only need the local URL, i.e. "clan_roster.php" not "http: //www2.kingdomofloathing.com/clan_roster.php") and it returns the text of that page, which can be stored in either a buffer or a string. Any variables appended in the query string (normally sent as GET requests) are automatically converted to POST, enabling you to interact with all the forms everywhere in Loathing.[/quote]
What he didn't say (and I personally find useful) is that if you use the minibrowser, it will tell you exactly what url has just been visited. So you can make a bet in the minibrowser and look at the field at the top to see how that was sent to the server. Then you can just use a variation on that URL when using the visit_url command.

You can avoid many of these obstacles by looking at the work of those who have already passed them. I have written a few scripts that parse URLs (First Things First for example, or you could definitely look at the item-turnin and final battle sections of the One-Click Wossname script) and there are plenty of other scripts around here that contain all of the concepts you'll need to write your script.

One-click Wossname was one of my best scripts I found for teaching me to program in ash. I learned more from that script than any other resource. Thanks zarqon, you helped make me the ash programmer I am today.
 

dj_d

Member
Very nicely put, Z. I still hope he'll give us the pseudocode version of his MMG script since picking that apart would be a fun exercise on its own - and, if it actually makes money, I'd code it up for him for free! :)
 

dawdawdo

Member
Looks like Zarqon gave you a pretty good head start on this. It looks like this script can be modified to fit most conceivable betting strategies.

I, too, am very interested to see how gambler's ruin is averted. If you decide not to post the final script, please let us at least see the proof. There's enough mathies in the forum that at least one of us can penetrate it. Good luck.

Edit: Oh, and here's the link to Zarqon's script:
http://kolmafia.us/showthread.php?t=1611&highlight=money+making+game
 
Top