| Name | Typ | Von |
|---|---|---|
| Organize Inventory Items Alphabetically | Definition | AFRLme |
Mit diesem Skript sortierst du die Items in deinem Inventar alphabetisch, aufsteigend oder absteigend.
Anweisungen
1. Füge das Hauptskript im Skripteditor von Visionaire Studio hinzu und lege es als Definitionsskript fest.
2. Zum aufsteigenden Sortieren legst du einen Aktionsteil Skript ausführen an mit:
arrangeItems(true)
3. Zum absteigenden Sortieren legst du einen Aktionsteil Skript ausführen an mit:
arrangeItems(false)
Hauptskript
--[[
Organize Items Alphabetically [v2] (12/02/2014)
Written by AFRLme [Lee Clarke]
-- + --
email: afrlme@outlook.com
paypal: afrlme@zoho.com
patreon: https://www.patreon.com/AFRLme
portfolio: https://afrl.me
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]
-- * local variables * --
local char, items, asc, desc -- empty variables
-- * function for toggling between ascending & descending order * --
function invSort(val)
asc = function( a,b ) return a:getName() < b:getName() end -- ascending (A-Z, 1-9)
desc = function( a,b ) return a:getName() > b:getName() end -- descending (Z-A, 9-1)
if val then return asc else return desc end
end
-- * function for updating inventory items alphabetically * --
function arrangeItems(val)
char = game:getLink(VGameCurrentCharacter) -- store current character
items = char:getLinks(VCharacterItems) -- store items
table.sort(items, invSort(val)) -- sort the items alphabetically
char:setValue(VCharacterItems, items) -- amend new item order to the inventory
end