1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Weird functionality. Need help.

Discussion in 'Skript' started by Conciulls13, Jan 26, 2019.

Tags:
Thread Status:
Not open for further replies.
  1. Conciulls13

    Conciulls13 Member

    Joined:
    Apr 29, 2018
    Messages:
    7
    Likes Received:
    1
    Skript Version (do not put latest): Skript 2.3.2
    Skript Author: Bensku
    Minecraft Version: 1.13.2
    ---
    Full Code:
    Code (Text):
    1. player picking up diamond pickaxe:
    2.     if item is not enchanted with fortune:
    3.         send "Pass a" to player
    4.     if allowedToObtain(player, item, "fortune") is false:
    5.         cancel event
    6.  
    7. function allowedToObtain(p: player, i: item, e1: string) :: boolean:
    8.     if {_i} is not enchanted with {_e1}:
    9.         send "Pass b" to {_p}
    10.         return true
    11.     return false


    Errors on Reload:
    Nill

    Console Errors: (if applicable)
    Nill

    Addons using (including versions):
    None

    Troubleshooting:

    Have you tried searching the docs? Yes
    Have you tried searching the forums? No
    What other methods have you tried to fix it? I have eliminated everything irrelevant to this very process.

    Explanation: When a player picks up a diamond pickaxe enchanted with fortune, this code sends the message "Pass B" which should not send based on the conditions. It also has the seemingly exact conditions as the message "Pass A", which is not sent.
    What's occurring here is either a mystery or going right over my head. Help is greatly appreciated!
     
  2. Best Answer:
    Post #2 by TPGamesNL, Jan 26, 2019
  3. TPGamesNL

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,354
    Likes Received:
    85
    Medals:
    e1 is a string, not an enchantment
     
    • Like Like x 1
  4. Conciulls13

    Conciulls13 Member

    Joined:
    Apr 29, 2018
    Messages:
    7
    Likes Received:
    1
    Could you explain further? I am not aware that enchantments are processed like event values.
    --- Double Post Merged, Jan 26, 2019, Original Post Date: Jan 26, 2019 ---
    Actually... don't bother. You're absolutely right. Thanks!! :emoji_joy:
    Code (Text):
    1. player picking up diamond pickaxe:
    2.     if item is not enchanted with fortune:
    3.         send "Pass a" to player
    4.     if allowedToObtain(player, item, fortune) is false:
    5.         cancel event
    6.  
    7. function allowedToObtain(p: player, i: item, e1: enchantment) :: boolean:
    8.     if {_i} is not enchanted with {_e1}:
    9.         send "Pass b" to {_p}
    10.         return true
    11.     return false
     
    • Like Like x 1
Thread Status:
Not open for further replies.
Loading...