multiple issues

I was working on building the datamaps for use in conjunction with the scriptlet posted herewhen the thought crossed my mind "what if one of the data maps is empty?" well seemingly a test would be reasonable.

Typing stash put (with the space on the end) resulted in the following:

> stash put

Donating meat to stash...
Stash list retrieved.

Now that was scary because there is no way to remove meat from the stash once you put it in. I have 12mil on the multi I was on at the time. I thought I might suddenly be broke.

The command did not put any meat in the coffer. Sighs of relief! This was verified by looking at the stash log. It sure was scary looking though.

I really should have tested with closet put I would have felt safer.
Attached files:
display_stash_closet_multi.ash The script I am working on.
inv_cleanup.ash The script which imports the above script.

I ran into a few problems:

first:
Code:
//I don't know if this is max for ash, but I read somewhere this is max for java
//can easily be fixed if not correct.
int maxint = 2147483648;
generated the error: error: For input string: "2147483648"
I commented out the line, and created a new maxint and set it to 1 to continue testing. What would the correct value be for maxint? the purpose can easily be seen in that I want to replace the value of maxint with * when generating cli commands from ash. Otherwise I want to be able to use positive and negative numbers as can be done in the cli.

second:
Code:
void execute_cleanup()
  {
  display_items.display_dump;
  closet_items.closet_dump;
  stash_items.stash_dump;
  }
generated the error Record expected (display_stash_closet_multi.ash, line 59) so I changed it to:
Code:
void execute_cleanup()
  {
//Record expected (display_stash_closet_multi.ash, line 59)
  //display_items.display_dump;
  //closet_items.closet_dump;
  //stash_items.stash_dump;
  display_dump(display_items);
  closet_dump(closet_items);
  stash_dump(stash_items);
  }
I was thinking I was doing the same thing inside the functions: display_dump(itemset set), closet_dump(itemset set), and stash_dump(itemset set) maybe not, but can someone point out the difference to me?

third:
after editing for the previous problem I got "error saving (filename)" from my text editor.
This normally means there is a sharing violation. kolmafia should have released the file though. Exiting and restarting kolmafia was my only solution. No Question, Just pointing this out.

The final problem:
Exception during call to cli_execute. Debug log printed. This one I cannot find a way around. Does anyone see an error on my part? There is only 1 cli execute call, and it is in display_stash_closet_multi.ash.

If need be I can send in a copy of my debug log.

Corrected file attached to bottom post
 

Attachments

  • display_stash_closet_multi.ash
    1.6 KB · Views: 54
  • inv_cleanup.ash
    6.9 KB · Views: 46

holatuwol

Developer
1. I know for sure the maximum integer is not even. So, try subtracting one.
2. You need parentheses on function calls. Otherwise, you're basically asking for a variable which probably doesn't exist.
3. Knowing there's an exception without seeing the stack trace is a dead end. :)
 
OK debug log sent to holatuwol@hotmail.com as instructed in debug.txt. I will test maxint, and add () so as to use the functions as intended, and edit this post. Thanks!

edit


1) subtracting 1 works
2) smacks forehead you explicitly said that when I read about the feature. The given fix worked.
3) More details noted: when trying to re-run the modified script kolmafia did nothing. after restarting kolmafia and trying to run the script again I noticed:

Removing items from display case...
Exception during call to cli_execute. Debug log printed.
There is no command in the script telling kolmafia to remove anything from my display case, it should be adding items.

Thanks for the help so far, and all the work on this great program!
 

holatuwol

Developer
The message is a display issue -- basically, when it refreshes your display case, it also prints a "removing from display case" even though it's not actually removing anything. That's been fixed for the release.

I investigated the debug log, and it turns out that KoLmafia doesn't handle "display put" all by itself very well (same is true for "closet put").  It appears as though this is exactly what's happening, since in lines 33-34:

PHP:
    temp_command = substring(temp_command, 0, last_index_of(temp_command, ", " ) - 1);
    cli_execute(command);

Obviously, the cli_execute parameter should be "temp_command" not "command".
 
if(temp_command != command)
{
//trim last camma space pair
temp_command = substring(temp_command, 0, last_index_of(temp_command, ", " ) - 1);
cli_execute(command);
}

I put the if statement in place to prevent execution of whatever put without parameters then forgot to modify the cli_execute statement. This would be another head-desk moment, but I'm not at a desk. uggh! Thank you Holatuwol

February 22, 2007, 09:09:51 AM


Now That I fixed that the script seems to be working as expected. Thanks Again!


edit again attaching corrected file.
 

Attachments

  • display_stash_closet_multi.ash
    1.2 KB · Views: 51
Top