Veracity's MMG scripts

This version is more robust, thank you! :D

Is it possible to give session totals if the script stops due to dropped event?

I just did a 50 iteration 2 chain run and one chain ran to completion, the other chain stopped at 47. Last entry in the gCLI was Waiting for MMG event... After several minutes of no more MMG action, (using the default 30 second wait) I checked and there were no pending bets from me.

So I'm assuming the script had stopped due to a dropped event. Then I thought that it would be nice to see totals up to the point the script stopped, and notification that the script has stopped due to a dropped event.

Or, since these are both very minor points, I guess you could just wait and see if your bug report bears fruit instead of adding functionality that may be made obsolete soon. ;)
 
Did you download my latest version? That should do exactly what you asked.

Here's an example. I was running 5 chains and keeping only a million out of the closet, just as a stress test. Here are the results:

Possible server problem: 3 chains pending but KoL says none and it's been 30 seconds without an event.
Chain 3 failed on iteration #60 placing bet for 9,605
Chain 5 failed on iteration #53 placing bet for 823,801
Chain 1 unresolved on iteration #63 placing bet for 1,037
Chain 2 unresolved on iteration #51 placing bet for 4,574
Chain 4 unresolved on iteration #68 placing bet for 1,037
Done running 5 chains of 200 bets.
Net winnings = -360,398. Net change to closet = 403,357

Obviously, a million Meat is not enough for 5 chains; I didn't have enough Meat to place a bet after one chain lost 9 times in a row - a one-in-512 chance. Since I was trying to run a total of 1000 chains, we can expect that number of sequential losses - or worse.

But notice the first line: KoL failed to send three events to chat, so three chains got stuck, and the script kept running the other two chains until it ran out of Meat. It then noticed that it was missing events for the three stuck chains, and exited.
 
Last edited:
Did you download my latest version? That should do exactly what you asked.

Hmmm... Yes, I did. I think. :confused:

Have you made any changes since your post this morning? Because I downloaded the three files this afternoon before visiting the MMG, but it definitely didn't give me all the info you show.

It just sat waiting for an MMG event long enough that I checked the MMG in the relay browser and it said I had no outstanding bets so I aborted the script. Perhaps I encountered a different problem then and the script didn't stop due to a dropped event.

I'll do some more testing.
 
how can I prevent that the "recent events" windows from kolmafia keeps stealing focus from other windows.
It's a little bit annoying when you try to type a document.
 
The script locked up on me again.

I am using the right script because it has the code to produce the text you quoted.

Code:
print( "Possible server problem: " + count( chains ) + " chains pending but KoL says none and it's been " + wait_limit + " seconds without an event." );

However, I ran two 50 iteration 3 chain runs. The first completed without problems, but the second run apparently lost track on the 50th iteration of chain 3, while chain 2 completed. The script has been sitting on Waiting for MMG event... for 20 minutes now. Checking the MMG in the relay browser shows no pending bets.

I'll post a snippet of the final bets with a note on chain 3's demise.

Bet 1/48/1: for 1,037 Meat -> bet #59444968
Waiting for MMG event...
09/07/09 05:18:58 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
09/07/09 05:19 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 2/49/1 (#59444963) taken by soloman van catz: 1,034 / 1,034 / 149,750
Betting 1,037 meat from inventory
Bet 2/50/1: for 1,037 Meat -> bet #59444974
Waiting for MMG event...
09/07/09 05:19:03 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you lost. Better luck next time.
09/07/09 05:19 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you lost. Better luck next time. <- Chain 3's last event.
Bet 1/48/1 (#59444968) taken by soloman van catz: -1,037 / -1,037 / 148,713
Betting 2,074 meat from inventory
Bet 1/48/2: for 2,074 Meat -> bet #59444976
Waiting for MMG event...
09/07/09 05:19:10 AM - soloman van catz (#1852498) took your 2,074 Meat bet, and you won, earning you 4,143 Meat.
09/07/09 05:19 AM - soloman van catz (#1852498) took your 2,074 Meat bet, and you won, earning you 4,143 Meat.
Bet 1/48/2 (#59444976) taken by soloman van catz: 2,069 / 1,032 / 150,782
Betting 1,037 meat from inventory
Bet 1/49/1: for 1,037 Meat -> bet #59444977
Waiting for MMG event...
09/07/09 05:19:16 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
09/07/09 05:19 AM - soloman van catz (#1852498) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 2/50/1 (#59444974) taken by soloman van catz: 1,034 / 1,034 / 151,816
Reached iteration limit for chain 2
Waiting for MMG event...

So I'm a bit at a loss as to why the script isn't timing out as it should.

Edit: Ah, perhaps it is associated with the memory leak issue or whatever we should call it. Chat is still scrolling, but KoLmafia is in a mostly unresponsive state. After aborting the MMG script, attempts to run the MMG-log script fail. Attempts to run other scripts tell me that the log script is running and it queues the next script.

> CURRENT: call scripts\mmg-log.ash
> QUEUED: call scripts\find_demons.ash

I can open various windows such as the gear changer, but any attempts to manipulate anything fails. All attempts to wake it up fail. I think it's time to go to bed. :)

Edit 2: Sorry, lack of sleep. That wasn't actually chain 3 that got hung up, but chain 1.
 
Last edited:
Decided to just unplug my router to see what happened. Script is operating as it should, so apparently the problems I was having are with KoLmafia itself.

Error: no bets found but 3 chains still pending
Chain 1 unresolved on iteration #39 placing bet for 1,037
Chain 2 unresolved on iteration #41 placing bet for 1,037
Chain 3 unresolved on iteration #41 placing bet for 2,074
Done running 3 chains of 50 bets.
Net winnings = 120,234. Net change to closet = 0

Thanks for all your efforts Veracity! :D

Edit: Hmmm... I'm not so sure it's the memory leak issue anymore. I just ran another 50 iteration 3 chain and much like the previous lockups, the script hung as chains were ending.

Bet 1/45/1: for 1,037 Meat -> bet #59466002
Waiting for MMG event...
09/07/09 07:04 PM - Kmart Unit (#268534) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 2/48/1 (#59465994) taken by Kmart Unit: 1,034 / 1,034 / 140,892
Betting 1,037 meat from inventory
Bet 2/49/1: for 1,037 Meat -> bet #59466028
Waiting for MMG event...
09/07/09 07:04 PM - ZsecretZ (#923198) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 1/45/1 (#59466002) taken by ZsecretZ: 1,034 / 1,034 / 141,926
Betting 1,037 meat from inventory
Bet 1/46/1: for 1,037 Meat -> bet #59466038
Waiting for MMG event...
09/07/09 07:05 PM - Alabit15 (#1638867) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 2/49/1 (#59466028) taken by Alabit15: 1,034 / 1,034 / 142,960
Betting 1,037 meat from inventory
Bet 2/50/1: for 1,037 Meat -> bet #59466049
Waiting for MMG event...
09/07/09 07:05 PM - EXOR169 (#1496404) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 1/46/1 (#59466038) taken by EXOR169: 1,034 / 1,034 / 143,994
Betting 1,037 meat from inventory
Bet 1/47/1: for 1,037 Meat -> bet #59466064
Waiting for MMG event...
09/07/09 07:05 PM - ZsecretZ (#923198) took your 1,037 Meat bet, and you won, earning you 2,071 Meat.
Bet 2/50/1 (#59466049) taken by ZsecretZ: 1,034 / 1,034 / 145,028
Reached iteration limit for chain 2
Waiting for MMG event...

I had completely exited Java prior to this run, so the allocated memory was starting fresh. At the time the script stopped, the memory usage shown in KoLmafia was only 49,412KB. There should still be some wiggle room there. And unlike this morning, KoLmafia isn't in a mostly locked up state.

Could the script be exiting and not giving the particulars for some reason?
 
Last edited:
bet ID numbers going negative

I'm having a few bet ID's return as negative numbers:

Bet 2/18/2 (#-12) taken by Pinkie Flamingo: -1,300 / -2,300 / -3,812
Doesn't seem to affect the script, but thought it was worth mentioning.
 
That's intentional - and necessary. When you place a bet, the same page which tells you that you did or did not succeed in placing it lists your pending bets. It is possible to successfully place a bet but have no bets listed because somebody already took it. In that case, we assign a negative bet id so that when the chat event eventually comes in, there is a bet to match it up with.
 
hanging issues

I too get a "Waiting for MMG event..." hang. When I check the bet page, there is nothing pending. Declaring peace will allow me to start the script again, but it will post message that it couldn't find whatever bet it was from before (right after someone takes a current bet from the new chains), and then hangs again. I can only seem to clear the maps by completely exiting mafia. Is there a way to flush supposed unresolved bet id's?
 
I get this a lot, I'm not sure if it's server lag or something but this is where I'm at.


09/21/09 06:38 AM - Dream of Me (#1031399) took your 10,000 Meat bet, and you lost. Better luck next time.
09/21/09 06:38 AM - andreaes (#194060) took your 20,000 Meat bet, and you won, earning you 39,960 Meat.
09/21/09 06:38 AM - Nikki xx (#1573226) took your 20,000 Meat bet, and you won, earning you 39,960 Meat.
09/21/09 06:38 AM - andreaes (#194060) took your 10,000 Meat bet, and you won, earning you 19,980 Meat.
09/21/09 06:38 AM - andreaes (#194060) took your 40,000 Meat bet, and you won, earning you 79,920 Meat.
Bet 5/19/2: for 20,000 Meat -> bet #-1
Bet 1/16/3 (#59845586) taken by andreaes: 39,920 / 9,920 / 783,920
Betting 10,000 meat from inventory
Bet 1/17/1: for 10,000 Meat -> bet #59845605
Bet 2/17/1 (#59845578) taken by Dream of Me: -10,000 / -10,000 / 773,920
Betting 20,000 meat from inventory
Bet 2/17/2: for 20,000 Meat -> bet #59845606
Bet 3/20/1 (#59845585) taken by andreaes: 9,980 / 9,980 / 783,900
Reached iteration limit for chain 3
Bet 4/13/2 (#59845587) taken by andreaes: 19,960 / 9,960 / 803,860
Betting 10,000 meat from inventory
Bet 4/14/1: for 10,000 Meat -> bet #59845607
Error: no bets found but 4 chains still pending
Chain 1 unresolved on iteration #17 placing bet for 10,000
Chain 2 unresolved on iteration #17 placing bet for 20,000
Chain 4 unresolved on iteration #14 placing bet for 10,000
Chain 5 unresolved on iteration #19 placing bet for 20,000
Done running 5 chains of 20 bets.
Net winnings = 803,860. Net change to closet = 0
Requests complete.

09/21/09 06:38 AM - Dream of Me (#1031399) took your 10,000 Meat bet, and you lost. Better luck next time.
09/21/09 06:38 AM - Nikki xx (#1573226) took your 10,000 Meat bet, and you won, earning you 19,980 Meat.
09/21/09 06:38 AM - andreaes (#194060) took your 20,000 Meat bet, and you won, earning you 39,960 Meat.

I run it with no closet meat. btw.
 
I love it, i was using a earlier version before

Thank you for this script.
In a few weeks i will probably be cursing your name, but using this strategy i have made 200k in about 1h of leaving the computer on, so for now, i am thankful for this script.

1000 meat 2.5 multiplier, closet after 85k, stop chain at 4 losses

I find this works quite well

Thanks V


Also


how can I prevent that the "recent events" windows from kolmafia keeps stealing focus from other windows.
It's a little bit annoying when you try to type a document.

I agree with you I found a fix

go startup, preferences and delete recent events in the tab open as new window
 
Last edited:
I am having a problem where the script just stops. It does not run through the correct amount of iterations for me.

Nvm: I figured out my problem.
 
Last edited:
Weirdest thing while betting

11/14/09 07:01:32 PM - Barracuda1 (#1888603) took your 6,742 Meat bet, and you lost. Better luck next time.
11/15/09 08:01 AM - function chatFocus(){if(top.chatpane.document.chatform.graf) top.chatpane.document.chatform.graf.focus();} defaultBind(47, CTRL, chatFocus); defaultBind(190, CTRL, chatFocus);defaultBind(191, CTRL, chatFocus); defaultBind(47, META, chatFocus);defaultBind(190, META, chatFocus); defaultBind(191, META, chatFocus); New Events:

I think that the recent events stuffed up there
 
Hehe, I think I am going to try out this script instead of waiting for somebody to create one for me. If I like the way it works, I'll send you some meat for your efforts veracity. Thanks for all your work towards the script. Also, I asked #6 a few questions to clear up how the MMG works for me. I was thinking you might have a better chance of winning the next bet if you lose the first, hence the working martingale strategy. I did some work on determining possible odds, and whatnot, when I got bored at school. But overall, it seems the MMG really is just 50/50 according to #6. He stated in a short term scale, half of the people will lose, and half of the people will come out on top, but at a long term scale everybody will eventually come out even. Besides that, every bet is 50/50 odds... So all you people who are MMGing and have negative totals, don't worry, if you keep at it you will eventually get back up. :D
 
at a long term scale everybody will eventually come out even. Besides that, every bet is 50/50 odds... So all you people who are MMGing and have negative totals, don't worry, if you keep at it you will eventually get back up. :D

This is factually incorrect. Whether you win or lose is fine in the short term as a measure of income. However, the house wins a small percentage of your meat every time you play. If you bet 1,000 meat 200 times, and win exactly 100 times, you have given away exactly 200,000 meat. However, your return is only 199,800 meat. Remember the house takes a 0.1% "handler's fee".

Magnify this up and suddenly we get to the true secret of the MMG - over an infinite number of iterations, EVERYONE loses. Long story short, there is no strategy to beat these odds. Your best bet if you insist on playing is to bet high and pull out quickly if you get a positive streak. The more times you play, the more you will conform to negative lean. Do not trust that a martingale strategy will never play out to an all loss round - eventually it is inevitable.

Tl;dr - while #6 is being truthful that the win/loss draw is exactly even odds, it is not purely win and loss that determines meat return. Don't draw false conclusions.
 
Oh, I was clearly not looking into that statement very well then, thanks for clearing up my statement. Now I think I understand this, seeing as the MMG was made specifically to take meat out of the game, this all makes perfect since. Still yet, even if we lose, this is just a game, it's always meant for entertainment...
 
Back
Top