• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Help Thread: Script Help Thread

Status
Not open for further replies.

C me

Creator of Pokemon League Of Legends
681
Posts
10
Years
    • Seen Apr 9, 2021
    Hi guys

    I'm having a problem with this part of my script where it counts how many steps you've taken and you get a different message after a certan number of steps, then after X amount of steps (250 in this case) the script can continue. I'm using this to indicate a passage of time.

    I'm using the variable 0x4048 in Emerald which is used to count how much soot you've collected. The tiles you walk on have their behaviour byte set as 24. Here's the script that I've made.

    Spoiler:


    This is only part of the whole script btw.

    Even if you take a ton of steps you never get past the first message which only checks for 25 or less steps. I know I've done something wrong with checking the variables but I'm not sure what.

    Thank You
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    Hi guys

    I'm having a problem with this part of my script where it counts how many steps you've taken and you get a different message after a certan number of steps, then after X amount of steps (250 in this case) the script can continue. I'm using this to indicate a passage of time.

    I'm using the variable 0x4048 in Emerald which is used to count how much soot you've collected. The tiles you walk on have their behaviour byte set as 24. Here's the script that I've made.

    Spoiler:


    This is only part of the whole script btw.

    Even if you take a ton of steps you never get past the first message which only checks for 25 or less steps. I know I've done something wrong with checking the variables but I'm not sure what.

    Thank You

    Tried to post this 3 times now.

    You don't need the LASTRESULT compare, it's just messing up your if/goto. Instead of checking if your var is less than or equal to 0x19, it's checking if 0x800D is less than or equal to 0x1, which it isn't.
    Just take them out. Then it will work.
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Tried to post this 3 times now.

    You don't need the LASTRESULT compare, it's just messing up your if/goto. Instead of checking if your var is less than or equal to 0x19, it's checking if 0x800D is less than or equal to 0x1, which it isn't.
    Just take them out. Then it will work.

    Thanks for the fast reply, I took them out but it still doesn't work.
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    Thanks for the fast reply, I took them out but it still doesn't work.

    Could you post the entire script? I've gone over your snippet and I can't see any issues beyond that. Are you certain that var 0x4048 is used for collecting sooty steps? Are you sure your tiles have the correct behavior byte?

    EDIT: According to this (https://bulbapedia.bulbagarden.net/wiki/Volcanic_ash), you jeed an item to collect ash. Maybe your steps aren't counted unless you have it. Just a thought.
     
    Last edited:

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Could you post the entire script? I've gone over your snippet and I can't see any issues beyond that. Are you certain that var 0x4048 is used for collecting sooty steps? Are you sure your tiles have the correct behavior byte?

    The whole script isn't necessary, what comes after this is fine.

    Spoiler:


    I've used a temporary flag because I don't need a permanent one for this script. The flag is set in another script which resets the var number so you can't build up steps before you know you're supposed to be.
    This one:

    Spoiler:


    Tiles have the right byte. I'm using the variable from this post from Sky High:

    Spoiler:
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    The whole script isn't necessary, what comes after this is fine.

    Spoiler:


    I've used a temporary flag because I don't need a permanent one for this script. The flag is set in another script which resets the var number so you can't build up steps before you know you're supposed to be.
    This one:

    Spoiler:


    Tiles have the right byte. I'm using the variable from this post from Sky High:

    Spoiler:

    I don't kow if you saw it but I think the var doesn't work without the Soot Sack.
    https://bulbapedia.bulbagarden.net/wiki/Volcanic_ash
    Try giving it to the player, to test it. If that doesn't work, you'll need another method to pass time.
     
    417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    The whole script isn't necessary, what comes after this is fine.

    Spoiler:


    I've used a temporary flag because I don't need a permanent one for this script. The flag is set in another script which resets the var number so you can't build up steps before you know you're supposed to be.
    This one:

    Spoiler:


    Tiles have the right byte. I'm using the variable from this post from Sky High:

    Spoiler:
    Are you sure on how behaviour byte 24 and var 0x4048 work? If you think about the functions of that route with soot, it may be changing the behaviour byte during the variable and tile change (you have to reset the route to be able to step on the same tiles) . So perhaps only the first steps on each tile are being counted during your testing which is why you couldn't get beyond 25. You should hook into the player step routines instead, which would also likely be faster.
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Are you sure on how behaviour byte 24 and var 0x4048 work? If you think about the functions of that route with soot, it may be changing the behaviour byte during the variable and tile change (you have to reset the route to be able to step on the same tiles) . So perhaps only the first steps on each tile are being counted during your testing which is why you couldn't get beyond 25. You should hook into the player step routines instead, which would also likely be faster.

    I thought that's only the case because stepping on that specific tile changes it to a normal grass tile with the 'ash' behind it so it's no longer the same tile with that behaviour byte.

    This was the only pedometer variable I found, I know there must be others I can do the same thing with. Firered has some documented pedometer vars, not sure which ones are Emeralds.
     
    417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    I thought that's only the case because stepping on that specific tile changes it to a normal grass tile with the 'ash' behind it so it's no longer the same tile with that behaviour byte.

    This was the only pedometer variable I found, I know there must be others I can do the same thing with. Firered has some documented pedometer vars, not sure which ones are Emeralds.
    I don't know. That's why I phrased it as a theory, not fact :/ If you can't find a real existing pedometer, (and this really wouldn't be ideal) it would be pretty easy to create one. Hook somewhere in a per step routine, load byte at address, increment by one, store back. You could also use this moment to compare the value of pedometer and set a flag. I don't really think adding like four var checks through script on each step makes much sense. So even if you find an existing pedometer, I would think the better way to handle it would be through a hook, not script.
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    I don't know. That's why I phrased it as a theory, not fact :/ If you can't find a real existing pedometer, (and this really wouldn't be ideal) it would be pretty easy to create one. Hook somewhere in a per step routine, load byte at address, increment by one, store back. You could also use this moment to compare the value of pedometer and set a flag. I don't really think adding like four var checks through script on each step makes much sense. So even if you find an existing pedometer, I would think the better way to handle it would be through a hook, not script.

    It really is just for one script. The repel script uses a pedometer, I could just use that one and make sure to reset it.
    The one for repel is 0x4021. I'll see if it works tomorrow.
     

    C me

    Creator of Pokemon League Of Legends
    681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    So the above method I suggested of using the repel variable works. Only problem is it says 'the repel wore off' and the number of steps can be manipulated by using repels of course but it's good enough so I'll stick with it.
    Thanks
     

    Teh Blazer

    Divider of Zero
    776
    Posts
    15
    Years
  • This is where I go for BSP questions, right?

    I was looking through BSP to see a reason for why my game freezes mid battle and I noticed a command that always seems to appear but I could never find out what it does. Is "cmd49 0x0 0x0" important? More importantly, what does it do?
     

    Uncommon

    Oozma Kappa
    192
    Posts
    8
    Years
  • (In FireRed) Is there a simple way to make a level script run every time you enter a map, not just the first time? Following diego's level script tutorial (using script type 02 and incrementing the flag variable) makes my script work perfectly one time. I thought I could simply remove the line where it increments the flag variable, but that causes the player to freeze as soon as the script finishes. I've also tried using script type 03, but it just freezes me on a black screen.

    Thanks in advance to anyone who can provide a little insight on this!
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • (In FireRed) Is there a simple way to make a level script run every time you enter a map, not just the first time? Following diego's level script tutorial (using script type 02 and incrementing the flag variable) makes my script work perfectly one time. I thought I could simply remove the line where it increments the flag variable, but that causes the player to freeze as soon as the script finishes. I've also tried using script type 03, but it just freezes me on a black screen.

    Thanks in advance to anyone who can provide a little insight on this!

    You can make it use an unused variable as the variable ID in A-map, and it should execute everytime. Use script type 04, most of the time that's what you need. 02 runs every frame iirc, and 03 I haven't checked out yet.
     

    Uncommon

    Oozma Kappa
    192
    Posts
    8
    Years
  • You can make it use an unused variable as the variable ID in A-map, and it should execute everytime. Use script type 04, most of the time that's what you need. 02 runs every frame iirc, and 03 I haven't checked out yet.

    Hi FBI! Thanks so much for the response. I'm trying out script type 04 now and I'm still seeing a black screen freeze. I've tested my script thoroughly and I'm confident this isn't a script issue. Below is a super simple script (XSE) I'm using for testing just to reproduce the behavior.

    Code:
    #dynamic 0x800000
    
    '---------------
    #org @main
    lockall
    msgbox @text MSG_NORMAL
    releaseall
    end
    
    '---------
    ' Strings
    '---------
    #org @text 
    = Try pressing A. Are you frozen?

    I'm compiling this, adding its offset as a level script on a map in A-Map, setting the flag variable (if applicable) to 4011 (unused), then saving and testing it in the game. Here are the results I see for different script types:

    Script type 02 - runs perfectly, then repeats when I press any button, indefinitely (certainly looks like you're right about it running every frame)
    Script type 03 - black screen freeze
    Script type 04 - black screen freeze

    If I use Script type 02 but add

    Code:
    setvar 4011 0x1

    before the end, the script runs and ends perfectly, but only 1 time.

    Is there anything obvious I'm doing wrong here? Thanks a lot for your help!
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Hi FBI! Thanks so much for the response. I'm trying out script type 04 now and I'm still seeing a black screen freeze. I've tested my script thoroughly and I'm confident this isn't a script issue. Below is a super simple script (XSE) I'm using for testing just to reproduce the behavior.

    Code:
    #dynamic 0x800000
    
    '---------------
    #org @main
    lockall
    msgbox @text MSG_NORMAL
    releaseall
    end
    
    '---------
    ' Strings
    '---------
    #org @text 
    = Try pressing A. Are you frozen?

    I'm compiling this, adding its offset as a level script on a map in A-Map, setting the flag variable (if applicable) to 4011 (unused), then saving and testing it in the game. Here are the results I see for different script types:

    Script type 02 - runs perfectly, then repeats when I press any button, indefinitely (certainly looks like you're right about it running every frame)
    Script type 03 - black screen freeze
    Script type 04 - black screen freeze

    If I use Script type 02 but add

    Code:
    setvar 4011 0x1

    before the end, the script runs and ends perfectly, but only 1 time.

    Is there anything obvious I'm doing wrong here? Thanks a lot for your help!

    oh, try to use 02, and then use variable 0x4000 instead of 0x4011 (set it in your script). The reasoning is that 0x4000 is a temporary variable that is refreshed on map reload :)
     

    Uncommon

    Oozma Kappa
    192
    Posts
    8
    Years
  • oh, try to use 02, and then use variable 0x4000 instead of 0x4011 (set it in your script). The reasoning is that 0x4000 is a temporary variable that is refreshed on map reload :)

    You're a genius! This works perfectly!

    Thank you so much for your help!
     
    77
    Posts
    9
    Years
    • Seen Dec 5, 2015
    I'm getting an error in XSE on compiling a script that I can't find an answer to from Google. Here's the error:
    XSE said:
    Error 9 "Subscript out of range" on line 167
    Here's line 167:
    Code:
    = [orange_fr]Good morning! Did you sleep well?\nI made breakfast, want some? Your\lmother and I are both staying\lhome today. We didn't want to\lleave you alone… [player] you\lremember our neighbor Mr. Picea\lright? Well… He disappeared last\lnight. The police are still\llooking for him. They found it\lunlikely that he would have\lwandered off by himself, and\linstead they are saying someone\ltook him away. You don't need to\lbe scared, the police are\lhandling the situation nicely. We\ljust didn't want to take any\lrisks, and we also don't want you\lto go out today. But that's okay!\lYou and I can have fun together!
    Text adjusted using XSE's text adjuster. What am I messing up?
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • I'm getting an error in XSE on compiling a script that I can't find an answer to from Google. Here's the error:

    Here's line 167:
    Code:
    = [orange_fr]Good morning! Did you sleep well?\nI made breakfast, want some? Your\lmother and I are both staying\lhome today. We didn't want to\lleave you alone… [player] you\lremember our neighbor Mr. Picea\lright? Well… He disappeared last\lnight. The police are still\llooking for him. They found it\lunlikely that he would have\lwandered off by himself, and\linstead they are saying someone\ltook him away. You don't need to\lbe scared, the police are\lhandling the situation nicely. We\ljust didn't want to take any\lrisks, and we also don't want you\lto go out today. But that's okay!\lYou and I can have fun together!
    Text adjusted using XSE's text adjuster. What am I messing up?

    XSE loves to be sucky and tell you that you're sucky as well. The text is just too long for the program to convert (if the program wasn't sucky, you could convert long lines)

    But you should never realistically ever have a textbox that long, it's endless scrolling dialogue that will get boring so quickly, there must be something to break it up. Look at regular Pokémon gameplay, the OWs move and stuff, there's an interruption or some other thing that happens
     
    76
    Posts
    9
    Years
  • I'm getting an error in XSE on compiling a script that I can't find an answer to from Google. Here's the error:

    Here's line 167:
    Code:
    = [orange_fr]Good morning! Did you sleep well?\nI made breakfast, want some? Your\lmother and I are both staying\lhome today. We didn't want to\lleave you alone… [player] you\lremember our neighbor Mr. Picea\lright? Well… He disappeared last\lnight. The police are still\llooking for him. They found it\lunlikely that he would have\lwandered off by himself, and\linstead they are saying someone\ltook him away. You don't need to\lbe scared, the police are\lhandling the situation nicely. We\ljust didn't want to take any\lrisks, and we also don't want you\lto go out today. But that's okay!\lYou and I can have fun together!
    Text adjusted using XSE's text adjuster. What am I messing up?
    I got this error in the past when my text contained invalid characters. This frequently happens when you write your dialog in Microsoft Word and then copy and paste it to XSE. From what I can tell, you have to change all your apostrophes from ' to ' (yes, there's a difference) and your ellipses from … to [.]. I think this will make it work.
     
    • Like
    Reactions: sab
    Status
    Not open for further replies.
    Back
    Top