bumcheekcity and hippoking's Rollover Management Script

Banana Lord

Member
The script seems to be ignoring my loathing legion necktie. Any plans to add support for this? (Auto-folding would be nice...) :)
 

Banana Lord

Member
You know, by necktie, I meant moondial >_< Only took me two weeks to work out the difference, though given that a SBIP will be the better option for most people, a better feature request would be for auto-folding. With Slyz's help, I have a function which may be useful.
PHP:
boolean get_foldable( item goal ) 
	{
	boolean look_get( item it, boolean DC ) 
		{ 
		if( DC )
			return( display_amount( it ) > 0 && take_display( 1, it ) ); 
		return( available_amount( it ) > 0 && retrieve_item( 1, it ) ); 
		} 
	foreach DC in $booleans[ false, true ] 
		{ 
		if( look_get( goal, DC ) )
			return true; 
		foreach form in get_related( goal, "fold" ) 
			{ 
			if( look_get( form, DC ) ) 
				{ 
				cli_execute("fold " + goal ); 
				if( item_amount( goal ) > 0 )
					return true; 
				} 
			} 
		} 
	return item_amount( goal ) > 0 ; 
	}
 
Last edited:

icon315

Member
I tried this
PHP:
boolean get_foldable( item goal ) 
    {
    boolean look_get( item it, boolean DC ) 
        { 
        if( DC )
            return( display_amount( it ) > 0 && take_display( 1, it ) ); 
        return( available_amount( it ) > 0 && retrieve_item( 1, it ) ); 
        } 
    foreach DC in $booleans[ false, true ] 
        { 
        if( look_get( goal, DC ) )
            return true; 
        foreach form in get_related( goal, "fold" ) 
            { 
            if( look_get( form, DC ) ) 
                { 
                cli_execute("fold " + goal ); 
                if( item_amount( goal ) > 0 )
                    return true; 
                } 
            } 
        } 
    return item_amount( goal ) > 0 ; 
    } 
	
void main (item goal){
 get_foldable(goal);
}
And it printed this in the CLI
Code:
Returned: origami riding crop
fullness => 0
inebriety => 0
spleen => 0
notes =>
descid => 232940208
levelreq => 0
Updating display case...
Requests complete.
 

Banana Lord

Member
Try this and tell me if you have the same problem.
PHP:
boolean get_foldable( item goal ) 
{ 
    boolean look_get( item it, boolean DC ) 
    { 
        if ( DC ) return ( display_amount( it ) > 0 && take_display( 1, it ) ); 
        return ( available_amount( it ) > 0 && retrieve_item( 1, it ) ); 
    } 
    foreach DC in $booleans[ false, true ] 
    { 
        if ( look_get( goal, DC ) ) return true; 
        foreach form in get_related( goal, "fold" ) 
        { 
            if( look_get( form, DC ) ) 
            { 
                cli_execute("fold " + goal ); 
                if ( item_amount( goal ) > 0 ) return true; 
            } 
        } 
    } 
    return item_amount( goal ) > 0 ; 
}
 

Banana Lord

Member
Oh. Sorry, I didn't actually read what you'd posted properly. It's a function not a command, so when you call it you need to provide it with valid parameters. Try this (exactly as it is).
PHP:
boolean get_foldable( item goal ) 
	{
	boolean look_get( item it, boolean DC ) 
		{ 
		if( DC )
			return( display_amount( it ) > 0 && take_display( 1, it ) ); 
		return( available_amount( it ) > 0 && retrieve_item( 1, it ) ); 
		} 
	foreach DC in $booleans[ false, true ] 
		{ 
		if( look_get( goal, DC ) )
			return true; 
		foreach form in get_related( goal, "fold" ) 
			{ 
			if( look_get( form, DC ) ) 
				{ 
				cli_execute("fold " + goal ); 
				if( item_amount( goal ) > 0 )
					return true; 
				} 
			} 
		} 
	return item_amount( goal ) > 0 ; 
	}
get_foldable($item[origami pasties]);
 

slyz

Developer
@Icon315: I don't know how you are calling the code you posted. I get:
Code:
> call test.ash legion jackhammer

Removing items from display case...
You acquire an item: Loathing Legion jackhammer
Requests complete.

@Banana Lord: For this script, I think the user should be able to prevent the script from taking items from their DC if he wishes. You might also want to take the items from your closet even if autoSatisfyWithCloset is false.
 

Banana Lord

Member
Yep, that's fair enough. You know better than me how to remove/improve that part ;) I just thought I'd post it here in case it saved BCC/hippo some time.
 

Banana Lord

Member
I'd like set up NCF.ash (a farming script I'm working on) to play nicely with rollover.ash and encourage users to download, but as it doesn't have any zlib settings I can only check that the user has elected to download it by using if(cli_execute("rollover.ash")). I'm concerned that a number of users may have their own "rollover.ash" scripts (which would result in unexpected behaviour). Can anyone see a way around this? Maybe the name of the script could be changed to something more unique, or would that be too inconvenient?
 

Theraze

Active member
Is there a way to tell if the "_version_bumcheekcityroll" preference exists? Since it's a daily preference, it will be empty if they haven't used it yet, but that would let Banana Lord know if they've ever run it on that character...
 

Winterbay

Active member
Well...
Code:
string test;
test = get_property("_testing");
if(test == "")
   print("Empty");

The code above prints "Empty" and since I am very certain I have no preference called _testing I'd say that it's impossible to distinguish between an empty setting and a nonexistsing one. But I may be wrong :)
 

bumcheekcity

Active member
This script is not in the process of being actively supported, I'm afraid. There is no way of telling if a user has it installed.

Possibly a feature request to detect if a script exists in the scripts folder?
 

Theraze

Active member
Is it possible to use try/finally to import and find if a script exists? Should it be possible? I tried it and when it didn't exist, the finally never executed. When it did exist, I got an error saying:
main method must appear at top level (zlib.ash, line 667)
Does finally not actually executing when try fails qualify as a mafia bug, or is this something that's functioning as is desired? For the record, here's the code I was trying:
Code:
ash boolean failed = true; try { import <zlib> failed = false;} finally {print (failed);}
 

Winterbay

Active member
I think all imports must be at the top of things in order to work, that was the problem zarqon had that instigated the quote in my sig...
 

Banana Lord

Member
Hmm. I'm hesitant to ask this, but if you're not planning to resume development of this script, would you mind if I cannibalised it for some of its features? Then I can just bundle the functionality with NCF.ash and avoid the problem alltogether.
 
Last edited:

bumcheekcity

Active member
Hmm. I'm hesitant to ask this, but if you're not planning to resume development of this script, would you mind if I cannibalised it for some of its features? Then I can just bundle the functionality with NCF.ash and avoid the problem alltogether.

Sure. Take what you want :D
 
Top