Okay this is a great bot and help me a lot for the things that i was trying to do manually.As a newb i play around a bit with programmer mode so far i could do something with my capability but i stuck now

I am looking to get an help from you guys with script.Here what i want to do ;
Let's say my dices goes for max. 30x red so instead of prerolls i want to have it like ;
for the first 10 red i want to use xx of my balance for martingale.
If dice still gives me a red for the next 10 (starts with 11th red) it should use xx of my balance again. (amount which covers all lost from previous 10 red )
If still no greed goes to last passage and for last 10 red it again uses xx of my balance. (amount which covers all lost from first 20 reds and gives me profit for the next 10)
If still no green it shouldnt go for 31th bet instead starts over.
I know how to use this ==> nextbet=balance*(percentage/100.0) for part of my current script but this one needs lots more to do i guess.
i am sure this is possible to do but almost impossible for a beginner.I will be glad if anyone helps me with that , cheers!