• 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.
Can anyone help me out with this level script? I just can't get it to work.
It freezes while I enter the map if flag 0x1014 has NOT been set.
If it has been set, the script runs.
I want this script to activate as soon as I enter the room out of a warp, this is a level script.
I put it [02] in AM.

I also would like to put more flagged scripts into this. Like after the party (and after coming back later) it should trigger something new. Do I have to put this in the same script? Or should I use another new script and add a new [02] in AM?

Code:
#dynamic 0x800000

#org @start
checkflag 0x1014
if 0x1 goto @party
releaseall
end

#org @party
lockall
playsong 0x111 0x1
msgbox @1 0x6
applymovement 0xFF @move
waitmovement 0xFF
setvar 0x4013 0x1
releaseall
end

#org @move
#raw 0x10
#raw 0xFE




#org @1
= [green_fr]\v\h01: Oh great.. I overslept a\nbit.\lIt seems they started the party\lwithout me.
 

Teh Blazer

Divider of Zero
776
Posts
15
Years
  • Can anyone help me out with this level script? I just can't get it to work.
    It freezes while I enter the map if flag 0x1014 has NOT been set.
    If it has been set, the script runs.
    I want this script to activate as soon as I enter the room out of a warp, this is a level script.
    I put it [02] in AM.

    I also would like to put more flagged scripts into this. Like after the party (and after coming back later) it should trigger something new. Do I have to put this in the same script? Or should I use another new script and add a new [02] in AM?

    Code:
    #dynamic 0x800000
    
    #org @start
    checkflag 0x1014
    if 0x1 goto @party
    releaseall
    end
    
    #org @party
    lockall
    playsong 0x111 0x1
    msgbox @1 0x6
    applymovement 0xFF @move
    waitmovement 0xFF
    setvar 0x4013 0x1
    releaseall
    end
    
    #org @move
    #raw 0x10
    #raw 0xFE
    
    
    
    
    #org @1
    = [green_fr]\v\h01: Oh great.. I overslept a\nbit.\lIt seems they started the party\lwithout me.

    Hmm... have you tried removing the "releaseall" command from your beginning thing so all it does is check for the flag and then if it isn't set, ends?

    Like this:
    Code:
    #org @start
    checkflag 0x1014
    if 0x1 goto @party
    end

    Couple of unrelated notes:

    1. That flag (1014) is awfully high, setting flags as high as that can cause bad eggs to appear in your pokemon box or mess up certain parts of your hack. Iirc, for fire red the list of safe flags you can and should use is from 200-2FF.

    2. Your level script doesn't activate until whatever variable you put in for it on advance map is set to the value that you gave it. So if you used var: 4013 and value: 0 (which I'm assuming you did), as long as your variable 4013 has any value that's not 0, your level script won't activate. In essence, the "value" part just means the number the variable is set at that will 'turn on' your script.

    As an example, setting the value to 1 in a-map would mean that the level script won't activate until the variable is set to 1. You can bypass your entire "checkflag" thing by leaving the variable at 0 and whenever you feel is ready, you can just slip in "setvar 0x4013 0x1" to a script that the player would activate before they enter your level-scripted area, which will 'turn on' your level script so when you enter the area it will activate.

    This will also help you with your question about having more scripts like this on the same map, since all you have to do is have different values for 4013 for each script and be careful about setting the value. For instance, if you have two level scripts both using 4013 and one has the value of 0x1 and 0x2, going through the first script and setting the value to 0x2 at the end will turn off the first one but also turn on the second one by accident. So just be careful about which variables you set and how they'll affect other level scripts/scripts you have in other areas.

    Hopefully I made sense in my explanation. :D
     

    DyingWillFlareon

    Burning Candle
    4,309
    Posts
    9
    Years
  • For some reason, making a script occasionally causes other scripts in the area to glitch out.
    For example:
    Script 1: (Girl NPC) Oh, hi there.
    Script 2: (Sign) Something City
    What happens:
    Script 1: Oh, hi there.
    Script 2: Som,hi there.

    Sorry I can't give a real script for it, it's done this at least 4 times now and I'm getting tired of repeatedly changing offsets until it finds ones that work, even though I just changed an NPC's script without touching the offset. It did this first with a Girl NPC and a Sign, then later on two sign scripts, now it's doing it on two different maps of the same house.

    Another thing is that last night I made a really long complicated script, then after compiling it twoce to be sure it saved, it reset to the last acript(which I also made), although I'm sure I probably did something wrong with it since I was tired and already annoyed.

    (Sorry I know I'm not good at explaining, it's in the Team Hack Off 1 thread in the Manor's park grounds with the trainers at the top if you want to see it.)
     
    144
    Posts
    12
    Years
  • Why can't you use dynamic offsets? You're using them like this, right? (for emerald)
    Code:
    #dynamic 0xE3CF64
    #org @start
    (rest of script)
    Honestly I have no clue about your problem, I think it could be possible you accidentally overwrote something using manual offsets. If you're not being careful this can happen.

    That is exactly how I attempt dynamic offsets. Dynamic offsets for me always result in a long string of
    Code:
    #raw 00FF
    or something like that instead of the script I actually wrote. Sometimes I get a beep (you know, the beep when you hit A on something of interest like a sign) from the game when I try to run the script, but that's all if that.


    UPDATE: Huh, dynamic offsets don't cause that much of a problem anymore, and in fact it fixed the corrupt map issue. Now I'm just stuck with a screwed up sign. However I did take a longer look at the compiler log and I noticed this:
    Code:
    #ORG: data
       -> @sign <-> 0x9C1B9E (0x8 bytes)
       -> @text <-> 0x9C1B9E (0x5A bytes)

    And, uh, are you using the recent version of XSE? XSE 1.1.1?

    At present I use PKSV rather than XSE. Does it run on Windows 2000?
     
    Last edited:
    10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    For some reason, making a script occasionally causes other scripts in the area to glitch out.
    For example:
    Script 1: (Girl NPC) Oh, hi there.
    Script 2: (Sign) Something City
    What happens:
    Script 1: Oh, hi there.
    Script 2: Som,hi there.

    Sorry I can't give a real script for it, it's done this at least 4 times now and I'm getting tired of repeatedly changing offsets until it finds ones that work, even though I just changed an NPC's script without touching the offset. It did this first with a Girl NPC and a Sign, then later on two sign scripts, now it's doing it on two different maps of the same house.

    Your scripts are overlapping. You shouldn't really edit existing scripts unless you know what you're doing - use dynamic offsets to get the new text pointers into free space.


    At present I use PKSV rather than XSE. Does it run on Windows 2000?

    Should do!
     
    Hmm... have you tried removing the "releaseall" command from your beginning thing so all it does is check for the flag and then if it isn't set, ends?

    Like this:
    Code:
    #org @start
    checkflag 0x1014
    if 0x1 goto @party
    end

    Couple of unrelated notes:

    1. That flag (1014) is awfully high, setting flags as high as that can cause bad eggs to appear in your pokemon box or mess up certain parts of your hack. Iirc, for fire red the list of safe flags you can and should use is from 200-2FF.

    2. Your level script doesn't activate until whatever variable you put in for it on advance map is set to the value that you gave it. So if you used var: 4013 and value: 0 (which I'm assuming you did), as long as your variable 4013 has any value that's not 0, your level script won't activate. In essence, the "value" part just means the number the variable is set at that will 'turn on' your script.

    As an example, setting the value to 1 in a-map would mean that the level script won't activate until the variable is set to 1. You can bypass your entire "checkflag" thing by leaving the variable at 0 and whenever you feel is ready, you can just slip in "setvar 0x4013 0x1" to a script that the player would activate before they enter your level-scripted area, which will 'turn on' your level script so when you enter the area it will activate.

    This will also help you with your question about having more scripts like this on the same map, since all you have to do is have different values for 4013 for each script and be careful about setting the value. For instance, if you have two level scripts both using 4013 and one has the value of 0x1 and 0x2, going through the first script and setting the value to 0x2 at the end will turn off the first one but also turn on the second one by accident. So just be careful about which variables you set and how they'll affect other level scripts/scripts you have in other areas.

    Hopefully I made sense in my explanation. :D


    Hmm, I think I should have a look at the flag list, it would be a waste if the rom won't longer function because of the wrong flag/var usages.

    Thanks a lot for your help.
    I have changed the script to the one below. I basically set the Value in AM to 0001. I have set command setvar 0x4013 0x1 in a previous script.
    After this script, it puts the Var back at value 0x0 apparently. It might not be a right fix, but it works and I guess this will do for now. But I would like to use more proper methods for the next ones.
    Thank you so much for your help and directions. It's much appreciated! :)

    Also, do you know a fix for the music problem: Basically it loads a small bit of the OST that runs on the map by default. Let's say I exit the map with no music. When I enter this new map, it plays 1 second of the Cerulean City OST (which is the default OST of the map) before it plays the song 0x111 (Game Corner OST). It's not really a huge problem, but well, I would like to have the minor problems fixed too. Hehe.
    Also, do you know if there is a difference between the second parameter of playsong? The first one sets the music, but the second one. Sometimes 0x0 works, while another time 0x1 seems to work. I have no idea why.

    (OST = Original SoundTrack, I dunno if others use this term on these forums :p )

    Code:
    #dynamic 0x800000
    
    #org @start
    lockall
    playsong 0x111 0x0
    msgbox @1 0x6
    applymovement 0xFF @move
    waitmovement 0xFF
    clearflag 0x9FF
    setflag 0x1014
    setvar 0x4013 0x0
    releaseall
    end
    
    #org @move
    #raw 0x10
    #raw 0xFE
    
    #org @song
    playsong 0x133 0x0
    releaseall
    end
    
    
    #org @1
    = [green_fr]\v\h01: Oh great.. I overslept a\nbit.\lIt seems they started the party\lwithout me.
     
    218
    Posts
    10
    Years
    • Seen Nov 12, 2021
    Hi, I use XSE for script and it works flawlessly except for one thing :
    When I use dynamic offsets it always write the 00's bytes. Bad thing, so every time I use dynamic I have to select a bunch of byte and turn them to 00, which is pretty annoying.
    Is there a way to make it seeking for FF bytes rather than 00 ?
     

    Splash

    But nothing happened.
    658
    Posts
    14
    Years
  • Hi, I use XSE for script and it works flawlessly except for one thing :
    When I use dynamic offsets it always write the 00's bytes. Bad thing, so every time I use dynamic I have to select a bunch of byte and turn them to 00, which is pretty annoying.
    Is there a way to make it seeking for FF bytes rather than 00 ?

    In XSE, Go to tool-> Free Space Finder and search for an offset there..

    I think you need some tutorials so click here or here to learn more about scripting
     
    218
    Posts
    10
    Years
    • Seen Nov 12, 2021
    This is not a problem of freespace, there is plenty of it. It's just if I use dynamic, XSE write the 00's bytes rather than the FF's one. I haven't problem of freespace when I script in static but dynamic is more convenient, that's all
     

    Joexv

    ManMadeOfGouda joexv.github.io
    1,037
    Posts
    11
    Years
  • Hi, I use XSE for script and it works flawlessly except for one thing :
    When I use dynamic offsets it always write the 00's bytes. Bad thing, so every time I use dynamic I have to select a bunch of byte and turn them to 00, which is pretty annoying.
    Is there a way to make it seeking for FF bytes rather than 00 ?

    In the beginning of your script add
    Code:
    #freespace 0xff
    But since you're having this issue, I'm assuming you're using Emerald. So you may want to apply the Emerald Stabilization patch to allow you to use more freespace safely. It may also be wise to switch to Gamer2020's unofficial xse release as it fixes bugs with writing to Emerald.
     

    U.Flame

    Maker of Short Games
    1,326
    Posts
    15
    Years
  • Well, I got around to testing the playerfacing command and it really is simple to use. I started by editing the script I planned to recycle. In this case, the player's mother. Adding the tiny parts and testing them went without a hitch, so I expanded to it and used the movement I planned to use for the script. That's when things messed up. Here's what it's supposed to be:
    Spoiler:


    Then here's what it turned into when compiled:
    Spoiler:

    Notice how it corrupted? This has happened before when I recycled scripts, so replacing the dynamic offeset usually gave it the space it needed to prevent corruption, but that didn't work this time. Even erasing the unused parts of the script didn't prevent corruption. Where did I mess up?
     
    Last edited:

    PokéMew1

    Pokémon Fuchsia
    484
    Posts
    10
    Years
  • Is there any command to wait on a warp? lock won't do it as the script is released before it finishes warping.

    Thanks~
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • Is there any command to wait on a warp? lock won't do it as the script is released before it finishes warping.

    Thanks~

    Waitstate will wait until the warp is completed (You should always use this after warps just to prevent potential freezes)

    However, it'll be immediately after the warp is executed, so pause would be good if you're waiting via time.
     

    PokéMew1

    Pokémon Fuchsia
    484
    Posts
    10
    Years
  • Waitstate will wait until the warp is completed (You should always use this after warps just to prevent potential freezes)

    However, it'll be immediately after the warp is executed, so pause would be good if you're waiting via time.

    Thanks, putting a waitstate and pause 0x1 after the warp seemed to make it work perfectly :)
     

    LeiAlcantara025

    Hack Expert Most IN Mapping
    67
    Posts
    9
    Years
    • Seen Nov 8, 2019
    hello guys can someone give me a script for my hack please its kinda easy but for me its kinda hard to construct that kind of script making me dizzy please heres the plot im from upstairs and go downstairs and mom call for me and let me choose 3 pokemon also gives me a pokeball and a dex im really dizzy about flags im so sorry but ill get the hang of it please help me in my crisis
    hello guys can someone give me a script for my hack please its kinda easy but for me its kinda hard to construct that kind of script making me dizzy please heres the plot im from upstairs and go downstairs and mom call for me and let me choose 3 pokemon also gives me a pokeball and a dex im really dizzy about flags im so sorry but ill get the hang of it please help me in my crisis

    #dynamic 0x71A23C

    #org @start
    lockall
    setvar 0x6000 0x1
    applymovement 0x1 @move1
    waitmovement 0x1
    msgbox @callmom 0x6
    multichoice 0xe 0x0 0xMultichoicenum. 0x1
    compare 0x800D 0x0
    if 0x1 goto @option1
    compare 0x800D 0x1
    if 0x1 goto @option2
    compare 0x800D 0x2
    if 0x1 goto @option3
    msgbox @dad 0x6
    applymovement 0x1 @move2
    waitmovement 0x1
    hidesprite 0x1
    releaseall
    end

    #org @Bulbasaur
    msgbox @give 0x4
    givepokemon 0x1 0x5 0x0 0x0 0x0 0x0
    fanfare 0x13E
    msgbox @receive 0x4
    waitfanfare
    closeonkeypress
    setflag 0x828
    msgbox @nickname 0x5
    compare LASTRESULT 0x1
    if 0x1 call @okay
    msgbox @takecare 0x6
    release
    end

    #org @okay
    call 0x1A74EB
    return

    #org @Squirtle
    msgbox @give2 0x4
    givepokemon 0x4 0x5 0x0 0x0 0x0 0x0
    fanfare 0x13E
    msgbox @receive2 0x4
    waitfanfare
    closeonkeypress
    setflag 0x828
    msgbox @nickname2 0x5
    compare LASTRESULT 0x1
    if 0x1 call @okay
    msgbox @takecare2 0x6
    release
    end

    #org @Charmander
    msgbox @give3 0x4
    givepokemon 0x7 0x5 0x0 0x0 0x0 0x0
    fanfare 0x13E
    msgbox @receive3 0x4
    waitfanfare
    closeonkeypress
    setflag 0x828
    msgbox @nickname3 0x5
    compare LASTRESULT 0x1
    if 0x1 call @okay
    msgbox @takecare3 0x6
    release
    end

    #org @callmom
    = Hey! you're awake!!\pi'm going to let you choose\nat these three pokemon.\pAre you ready??

    #org @dad
    = Well good choice!\nI must be going now,you know im a\lbusy person my son,hope you\lunderstand me\lgood bye!See you later on the lab.

    #org @give
    = Do you like this Pokemon?

    #org @give2
    = Do you like this Pokemon?

    #org @give3
    = Do you like this Pokemon?

    #org @receive
    = [black_fr]Would you like to give a\nnickname to Bulbasaur?

    #org @receive2
    = [black_fr]Would you like to give a\nnickname to Squirte?

    #org @receive3
    = [black_fr]Would you like to give a\nnickname to Charmander?

    #org @nickname
    = [black_fr]Would you like to give a\nnickname to Bulbasaur?

    #org @nickname2
    = [black_fr]Would you like to give a\nnickname to Squirtle?

    #org @nickname3
    = [black_fr]Would you like to give a\nnickname to Charmander?

    #org @takecare
    = Nice picking Bulbasaur,\nit's a good grass type.

    #org@takecare2
    = Nice picking Squirtle,\nit's a good water type.

    #org@takecare3
    = Nice picking Charmander,\nit's a good fire type.

    #org @move1
    #raw 0x13
    #raw 0x13
    #raw 0x13
    #raw 0x13
    #raw 0x13
    #raw 0x10
    #raw 0x0
    #raw 0xFE

    #org @move2
    #raw 0x12
    #raw 0x10
    #raw 0x10
    #raw 0x12
    #raw 0x12
    #raw 0x0
    #raw 0xFE





    PLease!!! help!!!!! i really need one i cant get dad to move please its a multichoice sviprt please give me a full detail
     
    Status
    Not open for further replies.
    Back
    Top