Skip to content

Instantly share code, notes, and snippets.

@masterots
Last active January 15, 2024 02:13
Show Gist options
  • Save masterots/7dddc45214d218e6e992e62817a7372b to your computer and use it in GitHub Desktop.
Save masterots/7dddc45214d218e6e992e62817a7372b to your computer and use it in GitHub Desktop.
How to Use Inventory!
!inv [+/-/?/help/delete] [item] [quantity]
Accesses the cvar inv for the current character.
When specifying an item with a name longer than 1 word, use the format "Item Name"
!inv shows the current character's inventory
!inv ? Item searches for the given item
!inv + Item adds one of the given item
!inv + Item # adds the given number of the given item
!inv - Item removes one of the given item
!inv - Item # removes the given number of the given item
!inv delete clears out the inventory entirely
!inv help displays this
Other Notes
The inventory system will treat !inv +, !inv -, and !inv ? with no given item as just !inv.
If you are using !inv for the first time, it will automatically create the inv cvars required for the system to work.
When manipulating an item, !inv [+/-/?] will be able to find that item given only part of its name. This allows for easy inventory manipulation in most cases, but may cause problems if items with similar names are involved.
For example, doing !inv + "Flametongue Longsword" and then !inv + Longsword will result in Flametongue Longsword (2) rather than Flametongue Longsword (1) and Longsword (1)
Inventory Manager, Version 2.0.2 | Developed by @silverbass#2407
!servalias inv embed {{set("x","&2&" if "%2%"!="%2"+"%" else "")}}{{set("m","%1%")}}{{set("m","h" if m in "help" else "r" if m in "delete" else "p" if x=="" else m if m=="+" or m=="-" or m=="?" else "p")}}{{set("n",int("%3%") if "%3%".isdigit() else 1)}}{{set("n",int(m+str(n)) if m in "+-" else 0)}}{{set_cvar("inv","") if m=="r" or not exists("inv") else ""}}{{set("m","p" if m=="r" else m)}}{{set("f",inv.lower().find(x.lower()) if x!="" else -1)}}{{set("f",-1 if f<0 else 0 if f==0 else f if inv[f]=="$" else inv.rfind("$",0,f) if f>0 else -1)}}{{set("l",inv.find("$",f+1))}}{{set("dl",inv[f:l] if f>=0 and l>=0 else inv[f::] if f>=0 and l==-1 else "")}}{{set("g",dl.split("|"))}}{{set("a",(g[0].replace("$","") if len(g)>1 and m!="p" else "") if dl!="" else x if m!="p" else "")}}{{set("d",int(g[1].replace(" (","").replace(")","")) if len(g)>1 else 0)}} -title "{{name if m!="h" else "How to Use"}}{{" adds "+str(n)+" " if m=="+" else " searches for a " if (m=="?" or (m=="-" and a.lower() not in inv.lower())) else " removes "+str(min(-n,d))+" " if m=="-" and dl!="" else ""}}{{a}}{{"" if n<2 and n>-2 else "s "}}{{"" if m=="h" else "'s" if m=="p" else " to their" if m=="+" else " from their" if (m=="-" and dl!="") else " in their"}} Inventory!" {{set("nl",("$"+a+"| ("+(str(n+d)+")")+"\n" if (n+d)>0 else ""))}}{{set_cvar("inv",(inv if inv[-1:]=="\n" else inv+"\n")+nl if dl=="" else inv.replace(dl,nl)) if m in "+-" and a!="" else ""}} -desc "{{"__"+" "*200+"__\n"}}
{{(str(inv.replace("$","").replace("|","").replace("(1)","")) if inv!="" else "*Empty*") if m=="p" else (nl.replace("$","").replace("|","") if n+d>0 else "*None*") if m in "?+-" else ""}}" {{"" if m!="h" else get_gvar("8b40e3a0-528c-4747-a4c2-a0b5022af36a")}} {{"-footer \"!inv help for more info\"" if m!="h" else ""}} -color <color> -thumb https://goo.gl/6Zowo5 %1% %2% %3%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment