| Name | Typ | Von |
|---|---|---|
| Zyklusinventarartikel | Definition | AFRLme |
Mit diesem Skript blätterst du durch die Items in deinem Inventar.
Anweisungen
1. Füge das Hauptskript im Skripteditor von Visionaire Studio hinzu und lege es als Definitionsskript fest.
2. Setze im Skript den Wert slots = 0 auf die Anzahl der Inventarplätze in deinem Interface.
3. Standardmäßig lässt das Skript das Blättern nur zu, wenn mindestens so viele Items im Inventar sind, wie es Plätze gibt. Zwischen diesem Modus und „immer blättern“ wechselst du mit einem Aktionsteil Skript ausführen mit:
toggleCycleMode()
4. Zum Vorwärtsblättern (aufsteigend) legst du einen Aktionsteil Skript ausführen an mit:
cycleItems(true)
5. Zum Rückwärtsblättern (absteigend) legst du einen Aktionsteil Skript ausführen an mit:
cycleItems(false)
Hauptskript
--[[
Cycle inventory items by ascending or descending order [v2.1] (15/09/2022)
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, item, amt -- empty variables
local slots = 0 -- define inventory slot amount here
local cycle = false -- false = only cycle inventory when item amount equals same as or more than inventory slots. true = always cycle
-- * function for changing cycle mode * --
function toggleCycleMode()
if cycle then cycle = false else cycle = true end
end
-- * function for cycling through the inventory items * --
function cycleItems(asc)
char = game.CurrentCharacter -- store current character
items = char.Items -- store inventory items into a table
amt = #items -- get index number of last item
if cycle or amt >= slots then
if asc then item = items[amt]; table.remove(items, amt); table.insert(items, 1, item) else item = items[1]; table.remove(items, 1); table.insert(items, item) end
game.CurrentCharacter.Items = items -- update the inventory
end
end