• 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.

[Other✓] Dont release

  • 6
    Posts
    9
    Years
    • Seen Jan 5, 2015
    Hello there!
    I'm new to this forum and learning Scripting for Pokemon, I'm a web, mobile and software programmer and I love to learn new programming skills, I've found this tutorial here: ./showthread.php?t=164276 (sorry unable to post links, so I only show the tread number [it's in here]) which btw I find it extremely good, and I wanted to start learning it and try it.

    Now, what my problem is, my code make the "lock" and then nothing else happen, not even the release at the end, so I'm not sure what is wrong with my code? Hope I can get some help.

    Code:
    '-----------------------
    #org 0x71A8BA
    lock
    countpokemon
    compare LASTRESULT 0x0
    if 0x1 goto 0x871A838
    checkflag 0x8
    if 0x1 goto 0x871A848
    release
    end
    
    '-----------------------
    #org 0x71A838
    applymovement 0x1 0x871A8F4
    msgbox 0x871A85B '"You can't go out without a pokemon,..."
    release
    end
    
    '-----------------------
    #org 0x71A848
    applymovement 0x1 0x871A8F4
    msgbox 0x871A89B '"Hello there!\nTake this potion."
    setflag 0x8
    release
    end
    
    
    '-----------
    ' Movements
    '-----------
    #org 0x71A8F4
    #raw 12 'Step Left (Normal)
    #raw 11 'Step Up (Normal)
    #raw 2 'Face Left
    
    
    '---------
    ' Strings
    '---------
    #org 0x71A85B
    = You can't go out without a pokemon,\nit's dangerous out there!
    
    #org 0x71A89B
    = Hello there!\nTake this potion.

    Thank you for your help!
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    countpokemon
    compare LASTRESULT 0x0
    if 0x1 goto 0x871A838
    checkflag 0x8
    if 0x1 goto 0x871A848


    For one, your script only looks for having one pokemon and checking a flag (a flag which is unlikely to be safe).

    KarateKid said:
    Safe Flags:
    ->0x200-0x2FF

    If you were testing it with a pokemon, and without the flag checked then nothing would happen. If you have a pokemon and the flag is checked you'll find this script gives you a potion every time you talk to them. Saying that, you're actually lacking any giveitem command to actually give the potion.

    If flag X is checked when you receive a pokemon, then you don't even need the countpokemon option.

    For your applymovement, you're missing a #raw 0xFE at the end, and your #raws are possibly incorrect. Assuming you're using FireRed it should be 0x11 and 0x12 not just 11/12.

    Where did you get those offsets from by the way? Is it compiled in game and you decompiled it?
     
  • 6
    Posts
    9
    Years
    • Seen Jan 5, 2015
    Thanks for the fast reply, for the giveitem I know, it say I need to add a #define before it, so I removed it, because I have never seen another script that use #define giveitem ...
    I write the script with XSE and then compiled it, that is the code compiled, my offset I've found them using the tool "Free Space Finder" inside "Advance Map"

    I have writen the raws as #raw 0x11 but then when compiled it was converted to #raw 11.

    What I want is, check if the person has at least one pokemon, if yes and if the flag is not set, then give a potion, else dont do anything.

    Thank you.
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    Thanks for the fast reply, for the giveitem I know, it say I need to add a #define before it, so I removed it, because I have never seen another script that use #define giveitem ...

    Hmm, that's odd. What version of XSE are you using? The last edition was 1.1.1 I think?

    I write the script with XSE and then compiled it, that is the code compiled, my offset I've found them using the tool "Free Space Finder" inside "Advance Map"

    Ah right. Well that's another thing! You can use #dynamic 0x740000 to automatically find offsets for your script, and XSE makes sure they are clear to use. That way you don't have to use FSF.

    What I want is, check if the person has at least one pokemon, if yes and if the flag is not set, then give a potion, else dont do anything.

    Thank you.

    Code:
    #dynamic 0x740000
    #org @start
    lock
    countpokemon
    compare LASTRESULT 0x0
    if 0x1 goto @STOP
    [B]checkflag 0x200[/B]
    if 0x[B]0[/B] goto @GETPOTION // if flag is not set, go to next
    release
    end
    
    '-----------------------
    #org @STOP
    applymovement 0x1 @Move1
    [B]waitmovement 0x0 [/B]// waits for movement to finish
    msgbox @Talk1 0x6
    release
    end
    
    '-----------------------
    #org @GETPOTION
    applymovement 0x1 @Move1 // ??? Do you want a movement here as well? Not sure.
    [B]waitmovement 0x0 [/B]// waits for movement to finish
    msgbox @Talk2 '"Hello there!\nTake this potion."
    [B]giveitem 0xD 0x1 MSG_OBTAIN[/B]
    setflag 0x200
    release
    end
    
    
    '-----------
    ' Movements
    '-----------
    #org @Move1
    #raw 0x12 0x11 0x1 0xFE
    
    
    '---------
    ' Strings
    '---------
    #org @Talk1
    = You can't go out without a pokemon,\nit's dangerous out there!
    
    #org @Talk2
    = Hello there!\nTake this potion.
    
    #org @Talk3
    = I GAVE YOU A POTION // whatever you want.

    If this is a green floor-script tile, you'll need to include a 'setvar' command. Have a look in diego's tutorial, or in the one I linked above.

    If this is a person-script, you'll probably want to add in another 'msgbox' in the first section, before the 'release/end'.
     
    Last edited:
  • 6
    Posts
    9
    Years
    • Seen Jan 5, 2015
    I tryied your code, I had to download the latest XSE as the one I've donwloaded before this week wasnt the latest ( I had v 1.0.0 ) and now I can use giveitem and #raw isnt changing to 11, I only had to change one thing in msgbox @Talk2 and replaced it with 0x6, but when I run this code, and I step in the script event, it still do nothing, it do the lock then nothing else happens, the person that I want to move doesnt come talk to me.

    I've recorded my screen to show what it does, the person next to me is the one I want to come and talk.
    postimg.org/image/u81ayprxd/
     
  • 10,078
    Posts
    15
    Years
    • UK
    • Seen Oct 17, 2023
    Did you spot the note at the bottom about using 'setvar' if its a script tile? :) Probably that, I wasn't clear before what type of script you were using.
     
  • 6
    Posts
    9
    Years
    • Seen Jan 5, 2015
    Sorry about that, but I dont understand how or where to use the setvar, I know what it does but dont know how to use it for a tile script :/ where I can find the tutorial you're talking about? I dont see any link above.
     
    Back
    Top