Rainbow Gravitation made easy

My ideal Gravitation script would try to Gravitate the maximum number of times (note: not always 3) in both HC and aftercore. Print current wad totals, which wads are needed, and how many would be transmuted/purchased, get user feedback if necessary, then do it all. (HC would be limited by current MP, aftercore would assume unlimited MP.) The quick fix above for a wadless aftercorer would quite inefficiently purchase 1 of each wad three separate times.

Of course, this is one of those things which is arguably not worth the effort, since the current script works fine. This is one of very few scripts I run unedited.
 
Now that I'm spending some time in aftercore for Crimbo, I modified the script to cast Gravitation the maximum number of times if you have mall access (and mafia is allowed to make free use of it). It's not a big deal, but it was annoying me to have to use the script three times instead of once.

New version uploaded.
 
Weird. I thought I changed it. It definitely is updated now.

Enjoy your new ability to create three Rainbow Wads with a single use of the script, if you're in aftercore.
 
Thank you, it is updated now. And it works just as advertised.

One tiny note about the script name. I'm not sure a space inside a file name is such a good idea. For one, you can't use "call" from the CLI. The simple solution for me was to save it as Rainbow_Gravitation.
 
I see. I never do call from CLI so that problem is alien to me. Whenever I try to do that I get into trouble.

I've got a question about calling scripts from the CLI if you can answer it. If you've got a script that takes more than one parameter, how do you do that? Let's say that a script takes a string and a location, how can I pass that information in a CLI call?
 
I use the CLI quite a bit, I guess I am the type that likes to type commands, rather than use menus.

As I don't use any script that accepts two parameters, I don't have any idea how that would work.
 
You can call scripts that have spaces. In fact, I usually call this script by simply typing "Rainbow Gravitation" in the CLI.

I don't think there is a way to pass multiple parameters from the CLI, which is why people have written things in to their main()s that parse multiple data points from a single string parameter. A way around it might involve requiring quotes around strings so that a separator character could be used between parameters, but I don't think the functionality gain would necessarily be worth the bloat/effort.
 
Updated this script to use the new craft() command for wad transmutation. (Update to recent build is necessary to update the script.)

The advantage is that it will now detect if you want to use a chef in a box, and automatically repair your chef if it gets broken. Previously, you'd get screwed if your chef broke in the midst of wad transmutation.
 
Is there any way to make the script check if you've already used your daily casts of rainbow gravitation, and abort if you have? I tried looking around the forums and the mafia-wiki, but I can't seem to find anything dealing with this.
 
The preference "prismaticSummons" should be what you're looking for. Combine that with get_property(), and use it as the condition of an if statement.
 
Is there any way to make the script check if you've already used your daily casts of rainbow gravitation, and abort if you have? I tried looking around the forums and the mafia-wiki, but I can't seem to find anything dealing with this.

The script already does that. Was this a bug report, or a strangely worded request for information?
 
It was a stangely worded request for information. If I'd read your script a bit more carefully, I wouldn't even have had to ask for it :)
 
Is there a way to make this script and only this script automatically buy from the mall? I'll check and uncheck the preference every time if I have to, but if there's an easier way, I'd much prefer that.
 
Well, you could have the script save your autoSatisfyWithMall setting to an boolean, set it to true (if currently false), run its purchasing ways, and set it back (if different) when done. Only problem is that if the script fails with an error, your mall setting will remain true. If you aren't worried about cancelling it partially done, should be fine though.
 
Is there a way to make this script and only this script automatically buy from the mall? I'll check and uncheck the preference every time if I have to, but if there's an easier way, I'd much prefer that.

Or you could use this alias:
Code:
alias rainbows => ash boolean mall = to_boolean(get_property("autoSatisfyWithMall")); if(!mall) { set_property("autoSatisfyWithMall","true"); } int [int] my_wads; my_wads[1] = item_amount($item[hot wad]); my_wads[2] = item_amount($item[cold wad]); my_wads[3] = item_amount($item[spooky wad]); my_wads[4] = item_amount($item[stench wad]); my_wads[5] = item_amount($item[sleaze wad]); foreach wad in my_wads { if(my_wads[wad] < 3) { cli_execute("buy " + (3 - my_wads[wad]) + " " + to_string(to_item(1450+wad))); } } cli_execute("cast 3 rainbow"); if(!mall) { set_property("autoSatisfyWithMall","false"); }

It changes the property autoSatisfyWithMall to true if it is false and then buys the missing amount of wads and casts rainbow gravitation 3 times followed by resetting the property if it was false to start with.

ETA: This does not take into account a) if you have the skill or b) if you are in ronin or hardcore so you need to keep track of those things yourself :)
 
Last edited:
Then how about:

PHP:
alias rainbows => ashq import "Rainbow Gravitation.ash"; if(can_gravity()) {boolean usemall = to_boolean(get_property("autoSatisfyWithMall")); if(!usemall) set_property("autoSatisfyWithMall","true"); gravitate(); if(!usemall) set_property("autoSatisfyWithMall","false");}
 
Last edited:
Back
Top