84 lines
3.5 KiB
Plaintext
84 lines
3.5 KiB
Plaintext
|
// Setup Tool v0.7.0
|
||
|
|
||
|
integer enabled = TRUE; // Ist das Sytem aktiv?
|
||
|
integer defaultitem = "Anleitungsbuch"; // 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
|
||
|
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 timervalue = 185; // Nach wieviel Sekunden soll das HUD aktualisiert und Wasser/Nahrung abgezogen werden?
|
||
|
integer sub_food = 8; // Wieviel Nahrung soll abgezogen werden?
|
||
|
integer sub_water = 5; // Wieviel Wasser soll abgezogen werden?
|
||
|
|
||
|
default
|
||
|
{
|
||
|
state_entry()
|
||
|
{
|
||
|
llSetText("Setup-Tool v0.7.0\n-------------------------\nSetze alle Prims auf\ndie Gruppe und klicke\ndiesen Prim an.", <1, 0.7, 0>, 1.0);
|
||
|
}
|
||
|
touch_start(integer i)
|
||
|
{
|
||
|
list _dataStorage = getDataListFromDataStorage("game.hud");
|
||
|
llOwnerSay(_dataStorage);
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "enable", "TRUE");
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "defaultInventar", defaultitem);
|
||
|
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "hud.slots", "8");
|
||
|
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.enable", "TRUE");
|
||
|
_dataStorage = setDataEntryInDataList(_dataStorage, "stats.levels", "TRUE");
|
||
|
_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");
|
||
|
llRegionSayTo(llDetectedKey(0), 0, "Setup beendet.");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|