Commodity collected script.
In my never ending quest to extract as much information out of EDDI I came up with the following edit to the Commodity Collected Event. This is what fires off when you collect a commodity in your ship or SRV.
This script will say the commodity collect, if it's stolen, and then will report the Category and Average selling price of the Commodity. Getting the price info was tricky as there is no station that buys everything. I added conditions for each of the economy types, and then add stations selling the commodity's that aren't listed in the main stations.
I hope someone else likes this script as much as I do.
That's pretty good Zev! Now, I hope you don't mind a little suggestion? This is just my personal opinion, so dismiss it if you wish, but I'm a bit of a 'neat freak' with my scripting and the multiple nested IF/ELSE statements didn't 'feel' quite right. I gave the script a quick once-over and came up with the below. I think it takes about the same time to process, but (to me at least) looks a bit tidier.
Code:
{_ Commodity collected}{_ Triggered when you pick up a commodity in your ship or SRV}
{_ Context }
{SetState('eddi_context_last_subject', 'commodity')}
{SetState('eddi_context_last_action', 'collect')}
{SetState('eddi_context_cargo_name', event.commodity)}
{OneOf("Cargo","Commodity")}
{OneOf("container","canister")}
{if event.commodity:
of {event.commodity},
}
collected.
{if event.stolen:
Warning this item is marked as stolen.
}
{_ High Tech_Refinery}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Fowler Orbital", "Dvorsi")}
{if !marketcommodity.avgprice:
{_ Industrial}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Crossfield Terminal", "Gubian")}
}
{if !marketcommodity.avgprice:
{_ Agriculture}
{set marketcommodity to CommodityMarketDetails((event.commodity), "van Vogt City", "Maunggu")}
}
{if !marketcommodity.avgprice:
{_ Extraction}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Comper Dock", "Bactondinks")}
}
{if !marketcommodity.avgprice:
{_ Military}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Clebsch Survey", "Ombikio")}
}
{if !marketcommodity.avgprice:
{_ Service}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Bell Terminal", "Achenar")}
}
{if !marketcommodity.avgprice:
{_ Terraforming}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Morgan Terminal", "Maunggu")}
}
{if !marketcommodity.avgprice:
{_ Tourism}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Fort Lawrence", "Exioce")}
}
{if !marketcommodity.avgprice:
{_ Colony}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Severin Terminal", "Dvorsi")}
}
{if !marketcommodity.avgprice:
{_ Combat Stabilisers}
{set marketcommodity to CommodityMarketDetails((event.commodity), "Helin Dock", "Njiri")}
}
{if marketcommodity.avgprice:
{marketcommodity.name} is classified as {marketcommodity.category}
with an average selling price of {marketcommodity.avgprice} credits.
}
Well, use if you like, or don't. I'm glad you're taking the time to share your creations with everyone.
-=] Darkcyde [=-