#edit: Additon not Additioning

1 messages · Page 1 of 1 (latest)

signal osprey
#

I'm making an economy skript for my friend's server, and I'm having trouble making cheques... I made it so you can make them but I can't figure out a way to redeem them. I can't figure out how to make skript read the lore of an item and set the lore as a variable... can anyone help me?
Here is my current code:

  trigger:
    set {_number} to arg-1 
    if {econ::%player's uuid%} > arg-1:
      remove arg-1 from {econ::%player's uuid%}
      give event-player 1 paper named "&aCheque" with lore "&2%arg-1%"
    else:
      send "&4You do not have sufficient funds to create this cheque! Your current balance is &e%{econ::%player's uuid%}%" to player

on right click:
  if event-player's held item is paper named "&aCheque":
    ```
fiery badge
#

you have to change it a bit but it should get the job done

#
  1. if item is desired item
  2. loop all lines of lore
  3. keep track of the line number
  4. if line LINENUMBER contains desired text
  5. set variable to lore on line LINENUMBER
signal osprey
#

what is {_c}

fiery badge
#

the line number

#

when looping lore, loop-value = the lore itself

#

tbh you could prob just skip {_c} and just check if loop-value contains...

#

made it a fair bit ago

signal osprey
#

wait so {_c} is the first line of lore?

#

i havent use lore before sorry

fiery badge
#

{_c} is a local variable, defined exclusively in add 1 to {_c}

#

it'll always be equal to the number of the loop

#

say an item has 5 lines of lore

#

loop those lines:

#

first line -> c=1, loop-value="Line 1 of Lore"

#

second line -> c=2, loop-value="This is the second line of lore."

#

etc

signal osprey
#

It gets the lore of the item, but it doesn't get added to the player's balance yet, I can't seem to figure it out yet

#

what i have so far is

#
  if event-player's held item is paper named "&aCheque":
    loop lore of event-player's held item:
      if line 1 of event-item's lore contains "":
        set {_amt} to line 1 of event-item's lore
        add {_amt} to {econ::%player's uuid%}
        send "&eAdded &2%{_amt}%&eto your balance! Your new balance is &2%{econ::%player's uuid%}%&e!" to player ```
#

it doesnt add {_amt} to {econ::%player's uuid%}

#

but it does set the lore to {_amt}, it says it when it sends the message to the player

fiery badge
#

prob bc {_amt} isn't parsed as a number

#

if i had to guess

#

why are you checking if line 1 of lore is ""

#

could just ignore that part, considering the itemname is coloured

#

also what is the first line of lore exactly

#

does it have colour or a $

signal osprey
#

well it depends on the amount they made the cheque

#

it is &a

#

it has that color

fiery badge
#

so its just &a50

#

or whatever number

#

(and not &a$50)

signal osprey
#

im not very good at skript lol

fiery badge
#

set {_amt} to {_amt} parsed as number

signal osprey
#

so just set {_amt} to {_amt} parsed as a number ?

#

it still wont add it to the player's currency 😦

fiery badge
#

what does broadcast {_amt} say

signal osprey
#

<none>

#

as soon as it gets parsed as a number it gets turned into <none>

#

if i broadcast it before it gets parsed it says 100

#

which is the number on the cheque i made

#

Well imma go to bed for tonight, thanks for the help so far!

signal osprey
#

edit: Additon not Additioning

signal osprey
fiery badge
#

depends on whether or not you want people giving cheques with pennies

signal osprey
#

Ok

#

👍

signal osprey
#

I'm trying to make a bounty system and it's having trouble adding things to the {econ::%player's uuid%}

fiery badge
#

try setting {_amt} to uncolored line 1 of event-item's lore

signal osprey
#

Ok I'll try this out tmr thanks 🙂 👍