submitting commands through links to mafia?

deadned

New member
I really like that I can swap around my garden at the astral gash, before I ascend, but I also want to do it after I break ronin (which isn't always after breaking the prism). So I'm trying to write a relay script for my campground, to add a little link at the bottom of the page to swap to pumpkins or skeletons. Except here is where I'm hitting a brick wall. I've included a few links in my charpane in the past using "<a href='/KoLmafia/sideCommand?cmd= " and I see that the astral gash page uses "<a href='/KoLmafia/redirectedCommand?cmd= ". I took a peak at the source code and also found submitCommand , specialCommand, and parameterizedCommand. The problem is that when I use side command, it takes me to /charpane.php (which is fine for charpane links) the redirectedCommand takes me to the astral gash page, and the other commands simply return a blank page to the center frame after using the generated link.

So, how do I make the center frame show my campground after using the link?
 
That doesn't really answer my question though.

Also, why is it preferable to use two additional scripts over a feature already in mafia (albeit under-documented) ?
 
I have no idea what specialCommand or parameterizedCommand are for. I wonder what parameters, parameterizedCommand accepts.
 
None of the things you found are meant to be used by scripts (and if any documentation existed, I imagine it would be a long version of "don't use these"). For example, any meaningful use of redirectedCommand is preceded by
Code:
RelayRequest.redirectedCommandURL = "urlgoeshere";
and you can't do that from a script. You could use a direct URL instead of a mafia command if you want a simple solution.
 
To answer your question, you simply pass whatever command you want to your own script, and then the script would run it.

So, say you wanted a link to maximize for adventures (for example). You'd make a link to "charpane.php?cmd=maximize+adventures" (I'd rather use __FILE__ than hardcoding, but that's just me) then, in your relay script you just check form_fields() for cmd and execute whatever it is.
 
bordemstirs, I want to add a late thank you for your answer here.

Today I discovered the desire to add a workshop remodeling option to my campground relay script so I was wondering how I could have the script execute a command to use an item and then return to the campground. I was going to use CliLinks, but suddenly I remembered this old thread and looked up your answer. It works brilliantly!

Thank you!
 
Last edited:
Back
Top