ereinion
Member
I have created a short script to print the values of all the drops I can get from my familiars:
	
	
	
		
Hoewever, I have some issues with understanding the output I get:
	
	
	
		
How come some of the values are 0? Furthermore, values for e.g. the dream jar seems too low compared to what I get when I search for it in the mall (current price is 9200 meat).
Finally, I wanted the drops to be sorted descending instead of ascending, so I tried to change line 18 of the script to
	
		
After doing this, the output from the script changes to 
	
	
	
		
The order of the familiars is still the same, but the values stored for each of them has changed. Can someone please give me a pointer on where I am going wrong with this?
				
			
		PHP:
	
	int get_price(item item_to_check, float acceptable_age) {
    return ((historical_age(item_to_check) <= acceptable_age)? historical_price(item_to_check) : mall_price(item_to_check));
}
void print_drop_values() {
    familiar f;
    int[familiar] drop_value;
    
    foreach f in $familiars[] {
        //print(f.name);
        if (have_familiar(f)) {
            if (f.drops_limit > 0) {
                drop_value[f] = get_price(f.drop_item, 1);
            }
        }
    }
    
    sort drop_value by value;
    foreach f in drop_value {
        print(f + " - " + f.drop_item + " - " + drop_value[f]);
    }
}
void main() {
    print_drop_values();
}
		Code:
	
	[COLOR=olive]> test.ash[/COLOR]
Astral Badger - astral      mushroom - 0
Green Pixie - tiny bottle of absinthe - 0
Llama Lama -      llama lama gong - 0
Cotton Candy Carnie - none - 0
Baby Sandworm -      agua de vida - 105
Rogue Program - Game Grid token - 115
Li'l      Xenomorph - transporter transponder - 825
Pair of Stomping Boots - none      - 900
Bloovian Groose - groose grease - 1475
Blavious Kloop -      devilish folio - 1500
Angry Jung Man - psychoanalytic jar - 1500
Unconscious      Collective - Unconscious Collective Dream Jar - 2900
Grimstone Golem -      grimstone mask - 7250
Grim Brother - grim fairy tale - 7300
Miniature      Sword & Martini Guy - mini-martini - 9500
Galloping Grill - hot      ashes - 9539
Fist Turkey - none - 9800
Golden Monkey - powdered gold      - 9800
Adventurous Spelunker - Tales of Spelunking - 9850
Puck Man -      power pill - 9950
Ms. Puck Man - power pill - 15000
Machine Elf -      Deep Machine Tunnels snowglobe - 15000How come some of the values are 0? Furthermore, values for e.g. the dream jar seems too low compared to what I get when I search for it in the mall (current price is 9200 meat).
Finally, I wanted the drops to be sorted descending instead of ascending, so I tried to change line 18 of the script to
		Code:
	
	sort drop_value by -value;
		Code:
	
	[COLOR=olive]> test.ash[/COLOR]
Astral Badger - astral      mushroom - 15000
Green Pixie - tiny bottle of absinthe - 15000
Llama      Lama - llama lama gong - 9950
Cotton Candy Carnie - none - 9850
Baby      Sandworm - agua de vida - 9800
Rogue Program - Game Grid token - 9800
Li'l      Xenomorph - transporter transponder - 9539
Pair of Stomping Boots -      none - 9500
Bloovian Groose - groose grease - 7300
Blavious Kloop -      devilish folio - 7250
Angry Jung Man - psychoanalytic jar - 2900
Unconscious      Collective - Unconscious Collective Dream Jar - 1500
Grimstone Golem -      grimstone mask - 1500
Grim Brother - grim fairy tale - 1475
Miniature      Sword & Martini Guy - mini-martini - 900
Galloping Grill - hot      ashes - 825
Fist Turkey - none - 115
Golden Monkey - powdered gold -      105
Adventurous Spelunker - Tales of Spelunking - 0
Puck Man - power      pill - 0
Ms. Puck Man - power pill - 0
Machine Elf - Deep Machine      Tunnels snowglobe - 0The order of the familiars is still the same, but the values stored for each of them has changed. Can someone please give me a pointer on where I am going wrong with this?
 
	 
 
		 
 
		 
 
		