Don't click here unless you want to be banned.

LSL Wiki : EcoNameA0

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ia360925.us.archive.org

Eco-Name version A0 (alpha-zero)


Conceptually the EcoName is a way to allow for very efficient communication between ALife critters and food. This depreceated version was developed Never Rust and the EcosystemWorkingGroup.
The eco-name is a list of comma-separated values stored in an object's name. This data can be read easily by Detected functions during collisions or scans, and prevents the need for potentially resource-hogging llListen calls.

The EcosystemWorkingGroup used version "A0" (alpha-zero) for testing in Terminus in 2006. This version supports variables needed for basic eating.

Variables included in Eco-Name A0


List # Variable What is it for? Data type
0 Proper Name unchanging species name 36 characters max
1 Eco-Name version ensure correct version 2 characters, "A0"
2 Type determining if edible, other uses 1 character: "P"lant, "A"nimal, "R"obot
3 Root Food Energy amount from root integer 0-9999
4 Leaf Food Energy amount from non-root integer 0-9999
5 Action determining what the organism is doing 3 characters, capitalized; i.e. "EAT"
6 Target Key who the organism is doing Action to 36 character key
7 Requested Food how much the organism intends on eating integer 0-9999

Example Eco-Name: Shark, A0, A, 1000, 0, EAT, 133b98a7-b49a-47a1-91ea-35bf7a14810a, 340
Explanation: The shark is an animal that offers 1000 energy if eaten. He is looking to eat (me!) and would like to eat 340 units of energy/food if possible.


Proposed Variables

...will be implemented as needed and agreed upon



Other Information

...that can be gotten from llDetected* functions and thus does not need to be in the Eco-Name


Development and discussion: http://groups.google.com/group/SL-EcoSystem/browse_thread/thread/6512bdda94a3b269
Thanks to Laukosargas Svarog for the original ideas! (http://forums.secondlife.com/showpost.php?p=1042155&postcount=3)

EcoName Code


This open-source code is part of the Ecosystem project. Please read the EcosystemDisclaimer before using.
Please do not edit the code below. If you want to make changes, please create a new wiki page. Thanks.

//                        ~ ECO-NAME                                                                                     ~//
// These are the standard functions to access the Eco-Name.
// If you're going to make changes to these, please speak with Never Rust
// or others working on the Eco-system project to establish a new version number.
//
// Version A0 ("alpha zero" / initial testing)
// 0 - Proper Name (unchanging species name)
// 1 - Eco-Name version
// 2 - Type: "P"lant, "A"nimal, "R"obot, etc.
// 3 - Food/Energy amount from root
// 4 - Food/Energy amount from leaf
// 5 - Action ("EAT")
// 6 - Target Key
// 7 - Requested Food (how much you intend on eatting)

string MyProperName = "species name";        //!!! These need to be defined for the Eco-Name
string MyEcoNameVersion = "A0";
string MyEcoType = "A";                     //A=Animal, P=Plant, R=Robot
string MyDietType = "P";


SetEcoName(integer FoodRoot, integer FoodLeaf, string Action, key TargetKey, integer EnergyRequested) {
    list EcoName = [MyProperName, MyEcoNameVersion, MyEcoType, FoodRoot, FoodLeaf, Action, TargetKey, EnergyRequested];
    llSetObjectName(llList2CSV(EcoName));
}

string EcoName2ProperName(string name) {
    //if (EcoNameVersion(name) == MyEcoNameVersion) 
    return llList2String(llCSV2List(name), 0);
    //else return "";
}

string EcoNameVersion(string name) {
    return llList2String(llCSV2List(name), 1);
}

integer EcoName2FoodRootAmount(string name) {
    if (EcoNameVersion(name) == MyEcoNameVersion) return llList2Integer(llCSV2List(name), 3);
    else return 0;
}  

integer EcoName2FoodLeafAmount(string name) {
    if (EcoNameVersion(name) == MyEcoNameVersion) return llList2Integer(llCSV2List(name), 4);
    else return 0;
}  
string EcoName2Action(string name) {
    if (EcoNameVersion(name) == MyEcoNameVersion) return llList2String(llCSV2List(name), 5);
    else return "";
}

key EcoName2TargetKey(string name) {
    if (EcoNameVersion(name) == MyEcoNameVersion) return llList2Key(llCSV2List(name), 6);
    else return NULL_KEY;
}

integer EcoName2RequestedFood(string name) {
    if (EcoNameVersion(name) == MyEcoNameVersion) return llList2Integer(llCSV2List(name), 7);
    else return 0;
}


EcosystemWorkingGroup | Ecosystem | EcoName
There is no comment on this page. [Display comments/form]