MMG Martingale script

zarqon

Well-known member
[size=+1]MMG Martingale Script[/size]

I never play the MMG. Danger is not my middle name. But someone requested this script, so I thought after writing it for the requester I would share it with y'all. I will say, in testing it out I made over 5000 meat! Haha.

This script does pretty much what the title says. It plays the Money Making Game using the Martingale strategy. It will abort if at any time you don't have enough meat to place the next bet, and it will run as many chains as you specify.

Variables you can edit at the top of the script:

boolean bet_hagnks - choose the source of your betting money. Default is Hagnk's (true).
float factor - every time you lose, you bet a larger amount (X times your previous bet) until you win. The Martigale strategy gives 2 for X, but you may want to change that, as mentioned on the aforelinked wiki page.

How to use it:
  • Download the script to your scripts directory.
  • Optionally, tweak the aforementioned variables.
  • Run the script, either by selecting it from the scripts menu or typing "martingale" in the CLI. It will ask you for your starting bet, and the number of Martingale chains to run (enter 0 for infinite chains).
  • ...profit! (sometimes)

Note for scripters: If you have your own surefire MMG strategy and would like to script it, I made sure that the place_bet() function was flexible for other strategies. It places a bet and returns true if you win, false if you lose. If you don't have enough meat to place the bet, it aborts. Have fun!
 

Attachments

  • Martingale.ash
    2.3 KB · Views: 1,490
Last edited:

dangerpin

Member
Very cool beans, Z.

I found a minor bug

Code:
if (amt > 100000000) print("Chain maxed out past 100000000. You are very, very, very unlucky.","red");

should be changed to

Code:
if (amt > 100000000) print("Chain maxed out past 100000000. You are very, very, very dumb.","red");

:p
 

zarqon

Well-known member
Haha! :D

Maybe there's no such thing as luck, and they mean the same!

Oh -- and you definitely play the MMG right? I mean, Danger is your first name...
 

Federalist

New member
Question - does it just keep idling until someone has taken the bet? (Countdown : 10 seconds)

Thanks. :)

Also, why does it KMail you? And, finally, any chance of it logging?
 
Last edited:

zarqon

Well-known member
1) Yes. It will idle until someone takes your bet. You could go into the script and change the number to a larger one if you're commonly waiting a long time and would like to save server hits.

2) You're welcome! :)

3) It kmails me only once the first time you run the script because I used the notify command.

4) I believe everything that it prints to the CLI is logged, right? If not, what would you like it to log?
 

Federalist

New member
1) Yes. It will idle until someone takes your bet. You could go into the script and change the number to a larger one if you're commonly waiting a long time and would like to save server hits.

2) You're welcome! :)

3) It kmails me only once the first time you run the script because I used the notify command.

4) I believe everything that it prints to the CLI is logged, right? If not, what would you like it to log?

Erm, when I said 'log', I hadn't realized that on my next login in gave me all the information. One more question - is there any way to tell me what it's doing? Such as, "Placing 1000 Meat Bet!" "Placing 2000 Meat Bet!" "Placing 4000 Meat Bet!" ?
 

zarqon

Well-known member
Watch the CLI when it runs and you'll see it does that. You probably should always watch the CLI when running scripts.
 

Federalist

New member
Watch the CLI when it runs and you'll see it does that. You probably should always watch the CLI when running scripts.

Ah, great. Thanks. As a beggining script-user, are there any scripts/downloads other than the basic Mafia download I should look into?
 

zarqon

Well-known member
Yeah, take a look all over this forum. It depends what you want to automate, but Mafia can basically do it all. (except mallbots) What scripts there are, you can find.
 

tamahome

New member
I would like to modify this script to run my betting strategy, but I am rather lost on even how to do it. I haven't done any programming in years, and then what I have done was just some BASIC required for my electronics program. Any help would be appreciated.

Basically, I would like to set up a certain number of bet numbers (i.e. 1000, 2000, 5000, etc) up to say, ten variables. I would then like to have them bet in batches of five. I would also like to set up a number of wins, say three out of five wins, then it would return to the beginning and start again. If the required number of wins is not met, then it would go onto the next set of five with the next bet amount. If it makes it all the way through the the listed bet variables, it would then start over at the beginning. I would also like to be able to define those bet variables and the number of variables that it is going to have. So one day I only want five bet variables. The next I want fifteen. I would like it to be flexible enough to adjust on the fly depending on how I am running my bets at the time.

So basically
five bets of 1000
2 of those bets win
five bets of 2000
1 of those bets win
five bets of 5000
4 of those bets win
Start again
five bets of 1000
etc.
 

zarqon

Well-known member
This is doable, although probably not as flexible as you'd like. You can convert the script to use an external text file of your daily betting, which would be arranged as follows.

Code:
0     1000
1     2000
2     5000
3     etc

Note that those should be tabs and not spaces. Then, you can load that data into your script like so:

Code:
int[int] dailybets;
file_to_map("whateveryounamedit.txt",dailybets);

You now have a map of your daily betting. dailybets[0] will give you your first bet, in this case 1000.

So, you'd want to do something like

Code:
int wincount;
foreach bet in dailybets {
   wincount = 0;
   for i from 1 to 5 if (place_bet(dailybets[bet]))
      wincount = wincount + 1;
   if (wincount >= 3) continue;
}

That will run through your bets one time, stopping when a) you reach the end of your daily bets, or b) you win the required number of bets.

You could put that in a function and run that function X times (X perhaps being a parameter of main()) to get the behavior you describe.

I didn't write the whole thing for you because you expressed an interest in scripting it yourself. Good luck!
 

tamahome

New member
I hate to say it, but I have been wrestling with trying to get this to work all day long. I have been using the original script as a base and trying to implement the changes you suggested. I just can't seem to get any of it to work, and frankly at this point I am just more confused than anything. I am finding this code to be more confusing the more I look at it. I hate to ask, but could you finish it up? That may be the only way that I can figure it out.
 

Bale

Minion
To be honest, I also find some of this script to be rather confusing. ^_^;;

Why don't you post some of your mess. That way it can be a dialogue instead of begging. Dialogues are often more interesting and more instructive. I can promise you that you'll gain points for having actually tried it and nobody will mock your failure. Also, there's a lot more dignity in getting help than a handout.
 

tamahome

New member
Sorry, didn't want to sound like I was begging. I was just so frustrated at that point.

I have decided to scrap the whole thing and start over. I will build it up from the bottom and just reference this script when needed. Maybe then I can figure this out. I will post it when finished. It may be a couple of days though.
 

zarqon

Well-known member
Sorry to frustrate you. And even if you're starting from scratch, I recommend keeping the place_bet() function from this script. It's portable and very handy for any MMG-playing script. It returns false if you lost and true if you won -- very easy to use.

I've written a simpler version below for you in case you'd like to use it as a starting point. It uses more linear code with less nesting, and doesn't use an external map of data:

Code:
// paste the place_bet() function here.

int bet_five_times(int numtobet) {
   int wins = 0;
   print("Betting "+numtobet+" five times...","blue");
   if (place_bet(numtobet, true)) wins = wins + 1;     // using a for loop would avoid
   if (place_bet(numtobet, true)) wins = wins + 1;     // this repeated code
   if (place_bet(numtobet, true)) wins = wins + 1;
   if (place_bet(numtobet, true)) wins = wins + 1;
   if (place_bet(numtobet, true)) wins = wins + 1;
   return wins;
}

void main() {
   int winsneeded = 3;
   if (bet_five_times(1000) >= winsneeded) return;
   if (bet_five_times(2000) >= winsneeded) return;
   if (bet_five_times(5000) >= winsneeded) return;
   if (bet_five_times(9000) >= winsneeded) return;
   if (bet_five_times(18000) >= winsneeded) return;
}
 

tamahome

New member
I tried to run your script and it made a bet, the bet lost, but then it just seemed to hang. It didn't make anymore bets and it didn't make any kind of notifications.
I am trying very hard to understand how to use this code language, but I am still very lost. So, how does it make the bet, and how does it determine if it wins or loses? Then of course, where does it store the win or loss value? I guess what I am really asking is can you break the place_bet down line by line for me? If the reply is going to be extremely long, you can just send me a private message instead.
 

zarqon

Well-known member
@tamahome: Post the script you put together and we'll help you figure out why it's not working.
 

zarqon

Well-known member
I can see why you are frustrated. I'm also a bit frustrated myself, because I have been trying to help you write a script, instead of just writing it for you. "Teach a man to fish" and all that. If you post what you have so far, we can explain whatever problems are in your code bit-by-bit. But you haven't posted any code (even bad, non-working code), so it's very difficult to help you.

One possible solution to your bet hanging situation might be that you didn't have any meat in Hagnk's. The second parameter of the place_bet() function is called use_hagnks and should be true if you want to use Hagnk's meat, false if you want to use inventory meat. The example I gave you used true, but you might need to change that to false.
 
Top