Talk:Batch close: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Jasonharper
Bad example!
 
imported>StDoodle
mNo edit summary
 
Line 4: Line 4:
* In any case, an example that the user CAN'T SAFELY TRY FOR THEMSELVES does not strike me as being particularly educational.
* In any case, an example that the user CAN'T SAFELY TRY FOR THEMSELVES does not strike me as being particularly educational.
--[[User:Jasonharper|Jasonharper]] 11:58, 5 March 2010 (UTC)
--[[User:Jasonharper|Jasonharper]] 11:58, 5 March 2010 (UTC)
I won't comment on the first two parts, as JH surely knows what he's talking about far better than I could hope to. But for his last point, I wholeheartedly agree; ideally, a user could copy-paste any code found on a function page and try it out for themselves. But with this... bad idea.
--[[User:StDoodle|StDoodle]] 23:13, 8 March 2010 (UTC)

Latest revision as of 23:13, 8 March 2010

This is a really bad example of how to use batches:

  • The batchable commands are all executed conditionally, so the order in which the first instance of each one is unpredictable, and therefore the order in which the batched commands are executed is unpredictable. If both autosellable and mallsellable items were processed prior to the first item that had a nonzero closet amount, the batch of take_closet()s will be executed LAST. This really needs to be done in at least two separate batches - the autosell and mallsell can be safely done in the same batch, since at most one will be done for any given item.
  • There are extraneous server-hitting commands inside the batch, for no reason whatsoever. If cli_execute() became batchable (unlikely, but not entirely impossible), the script would malfunction because the inventory counts inside the main loop wouldn't reflect the outfit change. visit_url() is safe in a batch only because it has an individually significant return value.
  • In any case, an example that the user CAN'T SAFELY TRY FOR THEMSELVES does not strike me as being particularly educational.

--Jasonharper 11:58, 5 March 2010 (UTC)

I won't comment on the first two parts, as JH surely knows what he's talking about far better than I could hope to. But for his last point, I wholeheartedly agree; ideally, a user could copy-paste any code found on a function page and try it out for themselves. But with this... bad idea. --StDoodle 23:13, 8 March 2010 (UTC)