• 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 Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.
49
Posts
14
Years
  • Seen Sep 10, 2011
Hey guys.
So I'm trying to do a give pokemon comand and I wrote it out alright and worked fine. (Pokemon FR) Then I decided to add a showpokepic and hidepokepic and since then when I compile and test it, it decided to mix everything up for me, like thats what I wanted. When I go to change it it automatically changes it back to what I didnt want. I think it saved to the rom? If it did, how can I reuse offsets, since it appearently won't let me change it. I'm worried that those offsets are used memory I can't access now. Is that how it works?


Thanks.
 

Zeffy

g'day
6,402
Posts
15
Years
  • Age 27
  • Seen Feb 7, 2024
Hey guys.
So I'm trying to do a give pokemon comand and I wrote it out alright and worked fine. (Pokemon FR) Then I decided to add a showpokepic and hidepokepic and since then when I compile and test it, it decided to mix everything up for me, like thats what I wanted. When I go to change it it automatically changes it back to what I didnt want. I think it saved to the rom? If it did, how can I reuse offsets, since it appearently won't let me change it. I'm worried that those offsets are used memory I can't access now. Is that how it works?


Thanks.
Create a new script. Adding new commands in a compiled script will glitch it out.
 
49
Posts
14
Years
  • Seen Sep 10, 2011
Create a new script. Adding new commands in a compiled script will glitch it out.

Ok thanks, but is that offset now gone or used? And will it take up space as used memory? I tried compiling a number of times so it looks like I used a lot of memory.
 

Zeffy

g'day
6,402
Posts
15
Years
  • Age 27
  • Seen Feb 7, 2024
Ok thanks, but is that offset now gone or used? And will it take up space as used memory? I tried compiling a number of times so it looks like I used a lot of memory.
The offset you used is now used. You can't use it anymore, sorry. u_u
 

Jonny Buuz

La di da di do di da di dum...
56
Posts
18
Years
Ok thanks, but is that offset now gone or used? And will it take up space as used memory? I tried compiling a number of times so it looks like I used a lot of memory.

Just load the rom with your favorite hex editor and fill the space that the script took up with FF bytes. Then you can use your offset again.
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Just load the rom with your favorite hex editor and fill the space that the script took up with FF bytes. Then you can use your offset again.

Or use the #remove command in XSE.


Okay. Advanced scripters (read: people who know how to write a level script), I need your help.

Code:
#dynamic 0x800000

#org @start
#raw 02
#raw pointer @nextpart
#raw 00

#org @nextpart
#raw word 0x4033
#raw 0x0
#raw pointer @script
#raw 00

#org @script
playsong 0x112 0x0
msgbox @1 0x6
applymovement 0xFF @move
applymovement 0x1 @move1
waitmovement 0x0
msgbox @2 0x6
applymovement 0x1 @move2
waitmovement 0x0
fadesong 0x12C
msgbox @3 0x6
givepokemon 0x85 0x9 0xBD 0x0 0x0 0x0
fanfare 0x13E
msgbox @4 0x4
waitfanfare
closeonkeypress
setflag 0x828
msgbox @5 0x6
setvar 0x4033 0x1
release
end

#org @1
= [red_fr]AAAHHH!\nHEELLLP MEEE!\l[player]! MOM! HEEEELLLPPP!!!

#org @2
= [red_fr]What's going on out there?!\nRACHEL, are you okay?!

#org @3
= [red_fr]Here, [player].\nTake your sister's EEVEE with you.\nFind out what's going on\lout there!

#org @4
= [player] received RACHEL's EEVEE!

#org @5
= Be careful out there, [player].

#org @move
#raw 0x1D 0x62 0xFE

#org @move1
#raw 0x1D 0x1D 0x2 0x1B 0x1B 0x1B 0x3 0x1B 0x1B 0x1B 0x0 0xFE

#org @move2
#raw 0x20 0x20 0x1E 0x1E 0xFE

What am I doing wrong in this level script? The script freezes as soon as I enter that particular map... and when I decompile the script, it just gives me the offset (which would imply that there is no script there). However, upon opening the rom with Translhextion, I see that plenty of bytes have been used up by this script (and thus, the script was compiled). So uh, any ideas? I've been stuck on this for a few days now, can't seem to make my way around it.

Thanks in advance!

First, make sure you fixed the 0xffff glitch thingie:

http://www.pokecommunity.com/showthread.php?t=191500

Advance Map overwrites the 0000 that you put into the Value box, with FFFF. And since it's subtracted by 1, and FFFF is the highest number you can insert, the level script glitches up.


To fix this, you go to the header tab, and press Ctrl+H to get professional header view. You should see an area called "Map Options". And within it you should see "Map script offset"

rshsaq.jpg


Copy the map script offset, and open your ROM in XSE.
Once done, paste the offset in the "decompile box" and click on "level script"



205cqc6.jpg

(This is the old XSE, but they both function similarly.)


After you've pasted the offset, and toggle the level script decompile feature (last button to the right) click decompile or "Shift+Ctrl+D"


a5gsk9.jpg

ATTENTION: OLD XSE! IF YOURS LOOKS LIKE THIS, THEN YOU NEED A SERIOUS UPDATE!


Code:
  [FONT=Segoe UI][SIZE=2]#org 0x71A242[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw pointer 0x880007D[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word [B]0xFFFF[/B][/SIZE]
[/FONT]


Code:
  [FONT=Segoe UI][SIZE=2]#org 0x71A242[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word 0x0[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw pointer 0x880007D[/SIZE]
[/FONT] [FONT=Segoe UI][SIZE=2]#raw word [B]0x0[/B][/SIZE]
[/FONT]


This is the important part. The 0xFFFF needs to be 0x0 so change it to 0x0 and compile. You should see the compiler log:

2jepm3n.jpg


Now your Level script should work, no problems at all...
 
49
Posts
14
Years
  • Seen Sep 10, 2011
Thanks a lot guys. That #remove command, how do I use that exactly? like:
#dynamic 0x000000
#remove(?)
 

FireFox

Dialga Fangirl
58
Posts
19
Years
  • Age 37
  • UK
  • Seen Feb 24, 2018
Hi guys, can you take a look at the below script:
Code:
'---LEVEL SCRIPT
#dynamic 0x800000
#org @start
hidesprite 0xC
setflag 0x200
setvar 0x7000 0x1
end

'--------MAIN---------
#dynamic 0x80000C
#org @start
lock
showsprite 0xC
applymovement 0xC @jmove
waitmovement 0x0
applymovement 0xFF @pldown
waitmovement 0x0
msgbox @intro MSG_KEEPOPEN
closeonkeypress
trainerbattle 0x3 0x1 0x0 @defeat
msgbox @outro MSG_KEEPOPEN
closeonkeypress
applymovement 0xFF @plleft
waitmovement 0x0
applymovement 0xC @jleave
waitmovement 0x0
hidesprite 0xC
setvar 0x7001 0x1
setflag 0x200
release
end

#org @jmove
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @pldown
#raw 0x2D
#raw 0xFE

#org @plleft
#raw 0x12
#raw 0x30
#raw 0xFE

#org @jleave
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @intro
= [red_fr]???: No, you're not leaving.

#org @defeat
= CRUD!

#org @outro
= [red_fr]MOVE IT.
It works perfectly but I can't help but feel I'm using one code to many. EG using setflag 0x?? hides the sprite in question without using hidesprite 0x??. So is hide/showsprite necissary or could I just use set/clearflag 0x?? ?
 

metapod23

Hardened Trainer
673
Posts
15
Years
  • Seen Aug 18, 2016
Thanks a lot guys. That #remove command, how do I use that exactly? like:
#dynamic 0x000000
#remove(?)

If the offset you wanted to set to free space was 0x800000, you would just put:

Code:
#remove 0x800000

and compile that script. Nothing else is needed.
 
42
Posts
19
Years
  • Age 37
  • Seen Sep 13, 2021
I was wondering, you know when a trainer is "out of useable Pokémon" & whites out, & goes to the nearest Pokémon Center/home? Is there any way to make something like the following happen?

Using XSE, it's Offset is 0x160C4B

'---------------
#org 0x160CFB
closeonkeypress
pause 0x3C
fadescreen 0x1
pause 0x3C
special 0x10F
waitstate
release
end


I'm recreating the Pokémon Ruby Festa 2002 Demo (waiting for my hack topic to be approved, here's a description of my hack) & apparently, once you got to the end of the demo (defeated all of the trainers and spoke to the 2 npcs at the top of Route 104), the game reset. The same happened if you both your Pokémon fainted. I'm basing my assumption on http://translate.google.com/transla...p://www10.ocn.ne.jp/~paya/rt.html&sl=ja&tl=en

If there's any way to implement this instead of the sethealingplace function, that would be amazing :D
 

0m3GA ARS3NAL

Im comin' home...
1,816
Posts
16
Years
I was wondering, you know when a trainer is "out of useable Pokémon" & whites out, & goes to the nearest Pokémon Center/home? Is there any way to make something like the following happen?

Using XSE, it's Offset is 0x160C4B

'---------------
#org 0x160CFB
closeonkeypress
pause 0x3C
fadescreen 0x1
pause 0x3C
special 0x10F
waitstate
release
end


I'm recreating the Pokémon Ruby Festa 2002 Demo (waiting for my hack topic to be approved, here's a description of my hack) & apparently, once you got to the end of the demo (defeated all of the trainers and spoke to the 2 npcs at the top of Route 104), the game reset. The same happened if you both your Pokémon fainted. I'm basing my assumption on http://translate.google.com/transla...p://www10.ocn.ne.jp/~paya/rt.html&sl=ja&tl=en

If there's any way to implement this instead of the sethealingplace function, that would be amazing :D
Well... just a th
ought, but why not have the sethealingplace link to an inaccessible pokemon center, and then that Pokemon Center's Level Script would reset the game...
 
42
Posts
19
Years
  • Age 37
  • Seen Sep 13, 2021
I know it's a dumb question, but how do you save your script?

I tried everything but it doesn't works.

PS: I use XSE.

Do you want to save the script or compile it? To save it, click the little floppy disk icon (can't get a pic of it. not at my windows machine right now, sorry). XSE will then ask you to select a location to save the script. To compile the changes back into the rom, click the gear icon. Hope this helps
 

Binary

え?
3,977
Posts
16
Years
  • Age 29
  • Seen Apr 7, 2014
Hi guys, can you take a look at the below script:
Code:
'---LEVEL SCRIPT
#dynamic 0x800000
#org @start
hidesprite 0xC
setflag 0x200
setvar 0x7000 0x1
end

'--------MAIN---------
#dynamic 0x80000C
#org @start
lock
showsprite 0xC
applymovement 0xC @jmove
waitmovement 0x0
applymovement 0xFF @pldown
waitmovement 0x0
msgbox @intro MSG_KEEPOPEN
closeonkeypress
trainerbattle 0x3 0x1 0x0 @defeat
msgbox @outro MSG_KEEPOPEN
closeonkeypress
applymovement 0xFF @plleft
waitmovement 0x0
applymovement 0xC @jleave
waitmovement 0x0
hidesprite 0xC
setvar 0x7001 0x1
setflag 0x200
release
end

#org @jmove
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @pldown
#raw 0x2D
#raw 0xFE

#org @plleft
#raw 0x12
#raw 0x30
#raw 0xFE

#org @jleave
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @intro
= [red_fr]???: No, you're not leaving.

#org @defeat
= CRUD!

#org @outro
= [red_fr]MOVE IT.
It works perfectly but I can't help but feel I'm using one code to many. EG using setflag 0x?? hides the sprite in question without using hidesprite 0x??. So is hide/showsprite necissary or could I just use set/clearflag 0x?? ?
I'm guessing the hidesprite is necessary. And, why do you always use the MSG_KEEPOPEN followed by a closeonkeypress?
You could always do something simple like this:
Code:
msgbox @outro 0x4
I know it's a dumb question, but how do you save your script?

I tried everything but it doesn't works.

PS: I use XSE.
You mean compiling? Read a tutorial on how to compile.
 
79
Posts
13
Years
  • Seen Aug 27, 2014
Need some spaining?!?

Im trying to figure out how to make things happen after other things specically. Like for example;the vermillion city officer jenny in yellow. Lets say i want to add officer Jenny to Fire Red. How would i make it to where she gives you squirtle only after i get the third badge?

im not going to post a script because i want to know if there is an action or some specific things i can do to a script, that way i learn it instead of having it hand fed to me!

BY THE WAY im using HackMews Amazing XSE for my script!
 

Chad -

 
687
Posts
14
Years
  • Seen Aug 27, 2012
Josh,

the third badge is activated if you set a flag 0x822 (setflag 0x822). In order to check whether you have or have not obtained the third badge, you use this:

Code:
...
...
checkflag 0x822 ' checks whether you have the third badge
if 0x1 goto @third_badge ' if you have it goto @third_badge
....
....
....
end

#org @third_badge
givepokemon command (I'm sure you know it)
....
end

etc...
Chad -
 
Last edited:
79
Posts
13
Years
  • Seen Aug 27, 2014
'-----------------------
#org 0x90056A
lock
faceplayer
checkflag 0x822
if 0x1 goto 0x8900971
if 0x0 goto 0x890098F
release
end

'-----------------------
#org 0x900971
givepokemon 0x102 0x15 0x0 0x0 0x0 0x0
fanfare 0x13E
waitfanfare
setflag 0x828
msgbox 0x890015E '"You have the THUNDER BADGE.\nYou mu..."
end

'-----------------------
#org 0x90098F
cmdC3 0x0


'---------
' Strings
'---------
#org 0x90015E
= You have the THUNDER BADGE.\nYou must be a well rounded\ptrainer.\nTake this POKeMHow is that MUDKIP?

i made a test script for this but it did not work sadly:\. I went up to the person i hit a and they face me but they dont talk or lock my players sprite or any of that
 

Binary

え?
3,977
Posts
16
Years
  • Age 29
  • Seen Apr 7, 2014
'-----------------------
#org 0x90056A
lock
faceplayer
checkflag 0x822
if 0x1 goto 0x8900971
if 0x0 goto 0x890098F
release
end

'-----------------------
#org 0x900971
givepokemon 0x102 0x15 0x0 0x0 0x0 0x0
fanfare 0x13E
waitfanfare
setflag 0x828
msgbox 0x890015E '"You have the THUNDER BADGE.\nYou mu..."
end

'-----------------------
#org 0x90098F
cmdC3 0x0


'---------
' Strings
'---------
#org 0x90015E
= You have the THUNDER BADGE.\nYou must be a well rounded\ptrainer.\nTake this POKeMHow is that MUDKIP?

i made a test script for this but it did not work sadly:\. I went up to the person i hit a and they face me but they dont talk or lock my players sprite or any of that
Code:
'-----------------------
#org 0x90056A
lock
faceplayer
checkflag 0x822
if 0x1 goto 0x8900971
[s]if 0x0 goto 0x890098F[/s]
release
end

'-----------------------
#org 0x900971
givepokemon 0x102 0x15 0x0 0x0 0x0 0x0
fanfare 0x13E
waitfanfare
setflag 0x828
msgbox 0x890015E '"You have the THUNDER BADGE.\nYou mu..."
end

'-----------------------
[s]#org 0x90098F
cmdC3 0x0[/s]


'---------
' Strings
'---------
#org 0x90015E
= You have the THUNDER BADGE.\nYou must be a well rounded\ptrainer.\nTake this POKeMHow is that MUDKIP?
Cross-outs are unnecessary parts.
 
79
Posts
13
Years
  • Seen Aug 27, 2014
'-----------------------
#org 0x90059A
lock
faceplayer
checkflag 0x822
if 0x1 goto 0x8900971
msgbox 0x8900A2F '"I found a sick POKeMON ,but\ni dont..."
callstd 0x6
release
end

'-----------------------
#org 0x900971
givepokemon 0x102 0x15 0x0 0x0 0x0 0x0
fanfare 0x13E
waitfanfare
setflag 0x822
msgbox 0x890015E '"You have the THUNDER BADGE.\nYou mu..."
end


'---------
' Strings
'---------
#org 0x900A2F
= I found a sick POKeMON ,but\ni dont trust anybody to raise\pit.

#org 0x90015E
= You have the THUNDER BADGE.\nYou must be a well rounded\ptrainer.\nTake this POKeMHow is that MUDKIP?

i think its perfect or at lease looks like it, but there is the final result. thanks a million guys!
 

FireFox

Dialga Fangirl
58
Posts
19
Years
  • Age 37
  • UK
  • Seen Feb 24, 2018
I'm guessing the hidesprite is necessary. And, why do you always use the MSG_KEEPOPEN followed by a closeonkeypress?
You could always do something simple like this:
Code:
msgbox @outro 0x4

It's the way I was taught I guess! Anyways, thanks for the info.
 
Status
Not open for further replies.
Back
Top