The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script getting script tiles to work

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old May 2nd, 2019 (1:42 AM).
STADIUM_TOKEN STADIUM_TOKEN is offline
 
Join Date: Mar 2019
Posts: 20
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.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old May 2nd, 2019 (6:00 AM).
Wiserospray's Avatar
Wiserospray Wiserospray is offline
 
Join Date: Apr 2019
Location: Yankee
Gender: Male
Nature: Timid
Posts: 11
You have a couple of arguements that are not in hex format. That might be your issue.

Quote:
#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
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old May 2nd, 2019 (11:38 AM).
STADIUM_TOKEN STADIUM_TOKEN is offline
 
Join Date: Mar 2019
Posts: 20
that was indeed the Problem, thanks for your help.
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:19 AM.