102 lines
4.2 KiB
Plaintext
102 lines
4.2 KiB
Plaintext
|
// Setup Tool [v0.07.02]
|
||
|
|
||
|
integer enabled = TRUE; // Ist das Sytem installiert?
|
||
|
integer levels_enabled = TRUE; // Werden Level gezählt (XP)?
|
||
|
integer defaultitem = ""; // Gegenstand, der neuen Inventaren automatisch hinzugefügt wird.
|
||
|
integer firststep = 1000; // 1. Level erreicht bei x XP
|
||
|
float multiplier = 1.25; // Nächster Level bei x * multiplier
|
||
|
integer maxlevel = 30; // Höchster zu erreichender Level ud Multiplikator füe max. Traglast/Level
|
||
|
float maxweight = 20; // Maximale Traglast aller Inventarslots zusammen
|
||
|
integer minlevel = 3; // Min. Level, den man haben muss, um das Item IMMER zu sammeln. Ist der Level kleiner, bekommt man es per Zufall.
|
||
|
integer sub_food = 8; // Wieviel Nahrung soll abgezogen werden?
|
||
|
integer sub_water = 5; // Wieviel Wasser soll abgezogen werden?
|
||
|
integer max_slots = 8; // Wieviele Slots hat das Main HUD (Wird mit dem Setup Tool vorgegeben)?
|
||
|
integer regchan = -1; // Wird für regionsweite Datenübermittlung benötigt
|
||
|
integer reghandler = -1;
|
||
|
|
||
|
|
||
|
default
|
||
|
{
|
||
|
state_entry()
|
||
|
{
|
||
|
getregionchannel();
|
||
|
//llSetText(llGetScriptName() + "\n-------------------------\nSetze alle Prims auf\ndie Gruppe und klicke\ndiesen Prim an.", <1, 0.7, 0>, 1.0);
|
||
|
llMessageLinked(LINK_ALL_OTHERS, 0, "RESET", llGetOwner());
|
||
|
|
||
|
}
|
||
|
touch_start(integer i)
|
||
|
{
|
||
|
list _dataStorage = getDataListFromDataStorage("game.hud");
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "enable", (string)enabled);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "defaultInventar", defaultitem);
|
||
|
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "hud.slots", (string)max_slots);
|
||
|
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.enable", (string)enabled);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels", (string)levels_enabled);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.firstStep", (string)firststep);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.multiplier", (string)multiplier);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.maxlevel", (string)maxlevel);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.maxweight", (string)maxweight);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.sub_food", (string)sub_food);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels.sub_water", (string)sub_water);
|
||
|
saveDataListToDataStorage(_dataStorage, "game.hud");
|
||
|
llRegionSay(regchan, "gamecommand;reload");
|
||
|
llRegionSayTo(llDetectedKey(0), 0, "Setup beendet.");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
getregionchannel()
|
||
|
{
|
||
|
list lstParcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_ID, PARCEL_DETAILS_AREA]);
|
||
|
regchan = (integer)("0x" + llGetSubString(llList2String(lstParcelDetails, 0), 0, 7));
|
||
|
if(regchan > 0)
|
||
|
regchan = -regchan;
|
||
|
|
||
|
//llListenRemove(reghandler);
|
||
|
//reghandler = llListen(regchan, "", "", "" );
|
||
|
}
|
||
|
|
||
|
list getDataListFromDataStorage(string _storage)
|
||
|
{
|
||
|
return llCSV2List(osGetDataValue(_storage));
|
||
|
}
|
||
|
|
||
|
saveDataListToDataStorage( list _dataList, string _storage)
|
||
|
{
|
||
|
string _csv = llList2CSV(_dataList);
|
||
|
osSetDataValue(_storage, _csv);
|
||
|
}
|
||
|
|
||
|
integer checkDataEntryInDataList(list _dataList, string _key)
|
||
|
{
|
||
|
integer _inListPosition = llListFindList(_dataList, [_key]);
|
||
|
|
||
|
if(_inListPosition == -1)
|
||
|
return FALSE;
|
||
|
|
||
|
return TRUE;
|
||
|
}
|
||
|
|
||
|
string getDataEntryFromDataList(list _dataList, string _key)
|
||
|
{
|
||
|
integer _inListPosition = llListFindList(_dataList, [_key]);
|
||
|
|
||
|
if(_inListPosition == -1)
|
||
|
return "";
|
||
|
|
||
|
return llList2String(_dataList, _inListPosition + 1);
|
||
|
}
|
||
|
|
||
|
list setDataEntryInDataList(list _dataList, string _key, string _value)
|
||
|
{
|
||
|
integer _inListPosition = llListFindList(_dataList, [_key]);
|
||
|
|
||
|
if(_inListPosition == -1)
|
||
|
{
|
||
|
_dataList += [_key, _value];
|
||
|
return _dataList;
|
||
|
}
|
||
|
|
||
|
return llListReplaceList(_dataList, [_value], _inListPosition + 1, _inListPosition + 1);
|
||
|
}
|