PDA

View Full Version : bug or change?



efilnikufecin
09-28-2006, 06:25 AM
put_shop(int price, int limit, item toput)
now seems to be
put_shop(int limit, int price, item toput)
would this be an intentional change or a mistake?

I modified the source to switch it back on my system, but constantly changing it every time I update will get kind of annoying so if it is intentional I will just re-write my scripts. I just need to know which is the case.

holatuwol
09-28-2006, 09:38 PM
That's odd ... I'll test this when I get out of Ronin. Things shouldn't have changed, and the source code I see looks like this:

public ScriptValue put_shop( ScriptVariable price, ScriptVariable limit, ScriptVariable item )
{
DEFAULT_SHELL.executeLine( "mallsell " + item.toStringValue() + " " + price.intValue() + " " + limit.intValue() );
return continueValue();
}

efilnikufecin
09-29-2006, 01:16 AM
The location of the change was in kolmafiacli.ash


private void executeAutoMallRequest( String parameters )
{
String [] tokens = parameters.split( " " );
StringBuffer itemName = new StringBuffer();

itemName.append( '*' );
for ( int i = 0; i < tokens.length - 2; ++i )
{
itemName.append( ' ' );
itemName.append( tokens[i] );
}

AdventureResult firstMatch = getFirstMatchingItem( itemName.toString() );
if ( firstMatch == null )
return;

StaticEntity.getClient().makeRequest( new AutoSellRequest( StaticEntity.getClient(), firstMatch,
StaticEntity.parseInt( tokens[ tokens.length - 2 ] ), StaticEntity.parseInt( tokens[ tokens.length - 1 ] ) ) );
}

I changed the last command in the function to:

StaticEntity.getClient().makeRequest( new AutoSellRequest( StaticEntity.getClient(), firstMatch,
StaticEntity.parseInt( tokens[ tokens.length - 1 ] ), StaticEntity.parseInt( tokens[ tokens.length - 2 ] ) ) );

for those who aren't familiar with the code and reading this the reason I came to that function from where Holatuwol started was:


if ( command.equals( "mallsell" ) || command.equals( "automall" ) )
{
executeAutoMallRequest( parameters );
return;
}
in the function public void executeLine( String line ) contained also in kolmafiacli.java

I came to the conclusion that this was the problem because the parameters were also reversed for the cli equivelent command mallsell. I may be wrong though because I assume that other areas of kolmafia use the executeAutoMallRequest function. If so I would have to check them on my home built copy to see if they function as desired. I have not traced all calls to executeline with mallsell as a partial parameter so I'm just not sure which areas make use of the function in question.

holatuwol
09-29-2006, 03:33 AM
The current source shouldn't contain any references to StaticEntity.getClient() at all (that was one of the big major changes that went into 9.2), and the -2 followed by -1 is correct (second from the last token corresponds to price, then the last token corresponds to the limit).* Where are you getting the source code?

efilnikufecin
09-29-2006, 06:16 AM
Where are you getting the source code?


https://svn.sourceforge.net/svnroot/kolmafia

I should be using source from before 9.2 was released but after 9.1 was released. I just d-loaded the source for revision 1778, and will give it a test run.

Test run complete. I hit an infinite loop:

Session timed out.
Sending login request...
Next login attempt in 1 second...
Validating login server...
Redirected to www.kingdomofloathing.com...
and start all over again.

never exits this loop. I see others saying the same, and just tried d-loading the precompiled public release of the jar. Same thing but 1 minute 15 second delay instead of 1 second. I also saw at least 1 other in the main forums saying that the parameters for mallsell and shop_put are reversed.

holatuwol
09-29-2006, 08:47 AM
It turns out it's not scripting at all -- all placement of items in the mall had been reversed.