I already have a script for a custom enchantments, but its really long after 30 custom enchantments.
I have a code like this:
Can i cut this to something like (i dont know its good, but i wanna give example):
^- i write addEnchantment(text) example:
addEnchantment(toxic3)
So every %{_t}% change for a toxic3?
I have a code like this:
code_language.skript:
on rightclick:
if player's tool is {@gem} with lore "{@toxic3}":
if {gem:toxic3:%player%} is true:
send "&aYou have already activated enchantment"
if {gem:toxic3:%player%} is false:
set {gem:toxic3:%player%} to true
send "&aYou activated your enchantment" to player
if player's tool is {@gem} with lore "{@toxic2}":
if {gem:toxic2:%player%} is true:
send "&aYou have already activated enchantment"
if {gem:toxic2:%player%} is false:
set {gem:toxic2:%player%} to true
send "&aYou activated your enchantment" to player
if player's tool is {@gem} with lore "{@toxic1}":
if {gem:toxic1:%player%} is true:
send "&aYou have already activated enchantment"
if {gem:toxic1:%player%} is false:
set {gem:toxic1:%player%} to true
send "&aYou activated your enchantment" to player
if player's tool is any sword or any axe or any pickaxe or any hoe or stick or any shovel:
if {gem:toxic3:%player%} is true:
if lore of player's tool contains "{@toxic2}" or "{@toxic3}" or "{@toxic1}":
send "&4Toxic is already in this item"
else:
set item's lore to "%coloured lore of item% || &8-&7=&f&l{&2&lʘ&f&l}&7=&8- || {@toxic3}"
set {gem:toxic3:%player%} to false
remove 1 {@gem} with lore "{@toxic3}" from player
if {gem:toxic2:%player%} is true:
if lore of player's tool contains "{@toxic2}" or "{@toxic3}" or "{@toxic1}":
send "&4Toxic is already in this item"
else:
set item's lore to "%coloured lore of item% || &8-&7=&f&l{&2&lʘ&f&l}&7=&8- || {@toxic2}"
set {gem:toxic2:%player%} to false
remove 1 {@gem} with lore "{@toxic2}" from player
if {gem:toxic1:%player%} is true:
if lore of player's tool contains "{@toxic2}" or "{@toxic3}" or "{@toxic1}":
send "&4Toxic is already in this item"
else:
set item's lore to "%coloured lore of item% || &8-&7=&f&l{&2&lʘ&f&l}&7=&8- || {@toxic1}"
set {gem:toxic1:%player%} to false
remove 1 {@gem} with lore "{@toxic1}" from player
Can i cut this to something like (i dont know its good, but i wanna give example):
code_language.skript:
function addEnchantment(t: text):
if player's tool is {@gem} with lore "{@%{_t}%}":
if {gem:%{_t}%:%player%} is true:
send "&aYou have already activated enchantment"
if {gem:%{_t}%:%player%} is false:
set {gem:%{_t}%:%player%} to true
send "&aYou activated your enchantment" to player
^- i write addEnchantment(text) example:
addEnchantment(toxic3)
So every %{_t}% change for a toxic3?