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.

i don't understand why it gives me an error

Discussion in 'Skript' started by Duoquote, May 26, 2018.

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

    Duoquote Member

    Joined:
    May 26, 2018
    Messages:
    3
    Likes Received:
    0
    I am trying to put this text file:

    Code (Skript):
    1. hello
    2. this
    3. is
    4. ---
    5. a
    6. test
    into pages::%pagecount% variable where "---" means a new page but it's not working. I am curious about whether we can put %variable% in another {variable::%variable%} or not.

    Code (Skript):
    1. on load:
    2.     set {text::*} to file contents of "help/texts.txt"
    3.     set {pagecount} to 1
    4.     loop {text::*}:
    5.         if {text::%loop-index%} is "---":
    6.             set {page::%pagecount%} to join {thiss::*} with "%newline%"
    7.             set {thiss::*} to ""
    8.             add 1 to {pagecount}
    9.         else:
    10.             add {text::%loop-index%} to {thiss::*}
     
  2. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    why are you doing {text::%loop-index%} you can just use loop-value
     
  3. Duoquote

    Duoquote Member

    Joined:
    May 26, 2018
    Messages:
    3
    Likes Received:
    0
    This is the last state of the code:
    Code (Skript):
    1. on load:
    2.     set {text::*} to file contents of "help/texts.txt"
    3.     set {pagecount} to 1
    4.     loop {text::*}:
    5.         if loop-value is "---":
    6.             set {page::%pagecount%} to join {thiss::*} with "%newline%"
    7.             set {thiss::*} to ""
    8.             add 1 to {pagecount}
    9.         else:
    10.             add loop-value to {thiss::*}
    I am getting this error:
    upload_2018-5-27_2-7-32.png
     
  4. Donut

    Addon Developer

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    175
    Medals:
    you forgot the brackets in the variable on line 6 %{pagecount}%
     
  5. Duoquote

    Duoquote Member

    Joined:
    May 26, 2018
    Messages:
    3
    Likes Received:
    0
    ;_; That fixed it but got another problem:
    upload_2018-5-27_2-27-6.png
    Code (Skript):
    1. on load:
    2.     set {text::*} to file contents of "help/texts.txt"
    3.     set {pagecount} to 0
    4.     loop {text::*}:
    5.         if loop-value is "---":
    6.             set {page::%{pagecount}%} to join {thiss::*} with "%newline%"
    7.             set {thiss::*} to ""
    8.             add 1 to {pagecount}
    9.         else:
    10.             add loop-value to {thiss::*}
     
Thread Status:
Not open for further replies.
Loading...