Talk:Tips, Tricks and Workarounds

From Kolmafia
Jump to navigation Jump to search

Discussion Recap

Discussion from Talk:Storage amount

Can anyone else verify, before I edit it in, that this function doesn't work on free pulls? --StDoodle (#1059825) 11:45, 21 September 2010 (UTC)

Verified. I believe that this was reported as a bug once. (Back when we had that awesome bug tracker.) However this behavior was clarified to be working as intended and hence, not a bug. The fact that an itemd doesn't require a pulls means that it is supposed to be treated differently. Use available_amount() minus item_amount() to verify presence of free pulls in Hangks. Then get them into inventory with retrieve_item() instead of with take_storage(). You're right that info should probably be on all relevant pages. --Bale 05:17, 22 September 2010 (UTC)

Perhaps we should start a special "caveats" page, and link to subheadings on it, for such info; it seems a bit much may be required to explain the situation to include it on every page. It would also be a good place to put info on things like Between Battle Scripts and adventure count in automation, etc. Thoughts? --StDoodle (#1059825) 15:10, 22 September 2010 (UTC)

I favor a caveats page. Or perhaps we could call it Tricks & Tips. We should add THIS there also. --Bale 22:22, 22 September 2010 (UTC)

Tips, Tricks and Workarounds* sounds good to me. I agree that those items philmaterplus points out should go there. Also, we should clean up the FAQ to only include one example of non-aborting booleans, and move the full list to this new page, I think (with a link of course). Perhaps this would even be a good page to put a dedicated file link to the syntax highlighting scheme for Notepadd++ (I favor having it on the wiki, so when it's updated with new ash functions, it's... you know, updated). I'll come up with other ideas, too, and leave them on the talk page when it's there. --StDoodle (#1059825) 17:04, 23 September 2010 (UTC)

  • Actually it doesn't sound perfect, which is why I'm not making it yet... hrmph.

Moving Discussion to Talk: Tips, Tricks and Workarounds. Since there may be a bit of discussion about the page before it gets created properly. We can always move the talk page if we change our minds about what it should be called. --Bale 21:18, 23 September 2010 (UTC)


Quirks & Hacks from PhilmASTErpLus

  • print() displays a blank line when given a string starting with a slash (/). To prevent this, the text color must be explicitly given. Easy to bypass, but weird.
  • "Anonymous" closures: ASH does not seem to accept anonymous closures by default.
int var1;
/* Do stuff */
{
    int var1;
    call_some_function();
    /* Do other stuff */
}

However, you can use a workaround with a if-clause.

int var1;
/* Do stuff */
if (true)
{
    int var1;
    /* Do other stuff */
}

As for where stuff like this could be used...I'm using it for initializing ASH scripts without creating any unnecessary functions or variables in the "namespace".

Great work so far, guys. One nitpick, though: I think the tip about using print() should be put in the appropriate function page, instead. I'll add it there ASAP. --PhilmASTErpLus 12:18, 26 September 2010 (UTC)

New Discussion

Ugh, sorry. Can't think of the best way to fix that ATM, it was half a joke. (Note to self; don't edit wiki drunk.) --StDoodle (#1059825) 06:32, 24 September 2010 (UTC)


Testing Scripts Offline

Is this section really necessary? I mean, there's a "validate scriptname" command available in the CLI. --Heeheehee 02:43, 13 January 2011 (UTC)

Well, I think that the section contains useful information. However it should probably be mentioned that the best way to test your script offline is to use the validate command. That is frequently what I do when I am offline due to rollover or I can't be bothered to log in. --Bale 03:52, 13 January 2011 (UTC)