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

[Script] getting script tiles to work

20
Posts
5
Years
    • Seen Jul 16, 2019
    Im using a variable to determine how a script tile should behave.

    With this I control the behavior of the Tile
    Code:
    #dynamic 0x800000
    #org @start
    
    applymovement 0xFF 0x03
    waitmovement 0x0
    
    lock
    
    compare 0x4014 0x0
    if 0x1 call 0x8037CD' This is the Offset for the according script I want to debug
    compare 0x4014 0x1
    if 0x1 goto @1' ignore this
    compare 0x4014 0x2
    if 0x1 goto @2' ignore either
    compare 0x4014 0x3
    if 0x1 goto @3'same here

    I set the variable 0x4014 to 0 so the Tile should call this next Script accordingly

    Code:
    #dynamic 0x800000
    #org @start
    msgbox @intro 0x6
    applymovement 0x7F @camera
    setvar 0x4011 0
    setvar 0x4012 0
    goto @setflags
    
    #org @setflags
    settrainerflag 0x00A
    settrainerflag 0x00B
    settrainerflag 0x00C
    settrainerflag 0x00D
    settrainerflag 0x00E
    goto @checkcounter
    
    #org @1
    checktrainerflag 0x00A
    if 0x1 goto @Battle
    showsprite 0x14
    applymovement 0x14 @trainersprite
    Trainerbattle 0x2 0x00A 0x0 @Challenge @defeat @addcounter
    
    #org @2
    checktrainerflag 0x00B
    if 0x1 goto @Battle
    showsprite 0x14
    applymovement 0x14 @trainersprite
    Trainerbattle 0x2 0x00B 0x0 @Challenge @defeat @addcounter
    
    #org @3
    checktrainerflag 0x00C
    if 0x1 goto @Battle
    showsprite 0x14
    applymovement 0x14 @trainersprite
    Trainerbattle 0x2 0x00C 0x0 @Challenge @defeat @addcounter
    
    #org @4
    checktrainerflag 0x00D
    if 0x1 goto @Battle
    showsprite 0x14
    applymovement 0x14 @trainersprite
    Trainerbattle 0x2 0x00D 0x0 @Challenge @defeat @addcounter
    
    #org @5
    checktrainerflag 0x00E
    if 0x1 goto @Battle
    showsprite 0x14
    applymovement 0x14 @trainersprite
    Trainerbattle 0x2 0x00E 0x0 @Challenge @defeat @addcounter
    
    #org @LvlUP
    call 0x00000
    
    #org @Battle
    call @confirm
    random 0x4
    compare LASTRESULT 0x4
    if 0x1 goto @5
    compare LASTRESULT 0x3
    if 0x1 goto @4
    compare LASTRESULT 0x2
    if 0x1 goto @3
    compare LASTRESULT 0x1
    if 0x1 goto @2
    compare LASTRESULT 0x0
    if 0x1 goto @1
    
    #org @addcounter
    call @hidetrainers
    addvar 0x4011 1
    addvar 0x4012 1
    goto @checkcounter
    
    #org @checkcounter
    compare 0x4011 0
    if 0x1 goto @starttraining
    compare 0x4011 1
    if 0x1 goto @Battle
    compare 0x4011 2
    if 0x1 goto @Battle
    compare 0x4011 3
    if 0x1 goto @Battle
    compare 0x4011 4
    if 0x1 goto @LvlUP
    
    #org @confirm
    compare 0x4012 0x4013
    if 0x2 call @setrecord
    buffernumber 1 0x4012
    msgbox @streaknumber 0x5
    compare LASTRESULT 0x1
    if 0x0 goto @end
    return
    
    #org @end
    call @hidetrainers
    applymovement 0x7F @moveaway
    waitmovement 0x0
    applymovement 0xFF @moveaway
    waitmovement 0x0
    release
    end
    
    #org @hidetrainers
    fadescreen 0x1
    hidesprite 0x14
    hidesprite 0x15
    fadescreen 0x0
    return
    
    #org @streaknumber
    = Your current winning streak is:\n[buffer1]\pDo you want to proceed?
    
    #org @setrecord
    copyvar 0x4013 0x4012
    return
    
    #org @starttraining
    msgbox @train 0x5
    compare LASTRESULT 0x1
    if 0x1 goto @battle
    goto @end
    
    #org @moveaway
    #raw 0x12
    #raw 0xFE
    
    #org @camera
    #raw 0x13
    #raw 0xFE
    
    #org @trainersprite
    #raw 0x13
    #raw 0x13
    #raw 0xFE
    
    #org @train
    = There are no Tournaments assigned\nat the moment. Do you want to\ltrain against the Trainers around\lhere?
    #org @challenge
    = Get ready for the next battle!
    #org @defeat
    = You defeated your opponent!
    #org @intro
    = Begin train script

    This script here is a little masterpiece, pretty complex for beginners so let me explain.

    Im using vars 0x4011 and 0x4012 as counters for battles 1-3 and counter for the current winning streak respectively. Also I use Var 0x4013 to set my highest Winning streak Record.

    This script checks the counters and Acts accordingly to them.
    If Var 0x4011 reaches 4 the script should Level up and start the next Template script just with stronger Trainers

    After every battle a MSGbox opens showing me the buffered winningstreak, this doesnt work as well because the TextBox Always Shows me 600, Maybe Im using the script wrong:
    Here is the Code again:
    Code:
    #org @confirm
    compare 0x4012 0x4013
    if 0x2 call @setrecord
    buffernumber 1 0x4012
    msgbox @streaknumber 0x5
    compare LASTRESULT 0x1
    if 0x0 goto @end
    return
    
    #org @streaknumber
    = Your current winning streak is:\n[buffer1]\pDo you want to proceed?

    At the beginning of this script I want a Textbox to open for debug purposes, but when I step on the script tile the game just freezes, not even starting the script.

    I have tried using Var 0x4016 and Var 0x4050 as valid Vars in Advance map and I have set the script tiles Unknown Value to 00 03 as mentioned in many tutorials.

    Where is the Error I cant seem to find it.
    And with the amount of Work in the second script I dont just wanna scrap it.
     
    11
    Posts
    5
    Years
  • You have a couple of arguements that are not in hex format. That might be your issue.

    #org @addcounter
    call @hidetrainers
    [S-HIGHLIGHT]addvar 0x4011 1[/S-HIGHLIGHT]
    [S-HIGHLIGHT]addvar 0x4012 1[/S-HIGHLIGHT]
    goto @checkcounter

    #org @checkcounter
    [S-HIGHLIGHT]compare 0x4011 0[/S-HIGHLIGHT]
    if 0x1 goto @starttraining
    [S-HIGHLIGHT]compare 0x4011 1[/S-HIGHLIGHT]
    if 0x1 goto @Battle
    [S-HIGHLIGHT]compare 0x4011 2[/S-HIGHLIGHT]
    if 0x1 goto @Battle
    [S-HIGHLIGHT]compare 0x4011 3[/S-HIGHLIGHT]
    if 0x1 goto @Battle
    [S-HIGHLIGHT]compare 0x4011 4[/S-HIGHLIGHT]
    if 0x1 goto @LvlUP

    #org @confirm
    compare 0x4012 0x4013
    if 0x2 call @setrecord
    [S-HIGHLIGHT]buffernumber 1 0x4012[/S-HIGHLIGHT]
    msgbox @streaknumber 0x5
    compare LASTRESULT 0x1
    if 0x0 goto @end
    return
     
    Back
    Top