Oh, thanks to me enduring a terrible yet populated Starfleet sim, I'm trying to create a realistic system for a Starfleet ship. Mainly using typical spoken computer commands, a HUD with buttons, and some remote controls. Since Deuterium and Dilithium are the two main fuel sources, I decided to make a system where you can add things to fuel tanks as long as adding won't go over. Dilithium is drained by the engines and Deuterium is drained by just about everything else. I need to keep the Deuterium and Dilithium values the same across all scripts, and present can't seem to get the Prim Description work around working. There's not even a single relavant exmple on the related LSL Portal page. Since its not a very long add_dilithium script so far I'll post it:
integer listen_handle;
integer dilithium_amount;
integer dilithium_max = 500000;
string dilithium_text;
default
{
state_entry()
{
dilithium_amount = (integer)llGetPrimitiveParams( [ PRIM_DESC ] )//Compiler dies here!;
llOwnerSay((string)dilithium_amount);
if (dilithium_amount == NAN)//If its not a number, set it to 500000
{
dilithium_amount = 500000;
}
listen_handle = llListen(999, "", "", "add_dilithium");
}
listen( integer channel, string name, key id, string message )
{
integer added_dilithium = dilithium_amount + 5000;
if (added_dilithium < dilithium_max)
{
dilithium_amount = added_dilithium;
string dilithium_added_say = "Dilithium added" + (string)dilithium_amount;
//dilithium_text = (string)dilithium_amount;
llSetPrimitiveParams( [ PRIM_DESC, dilithium_amount ] );
llOwnerSay(dilithium_added_say);
}
else
{
string dilithium_say = "Dilithium added" + (string)dilithium_amount;
llOwnerSay(dilithium_say);
}
}
}