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

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Fire Red
I want it so after you walk on script one script 2 will be there, but only until script 1 was finished what did I do? :pirate:

Script 1
Spoiler:



Script 2
Spoiler:

Flags...
It's all about flags...
Flags are like indicators, telling the ROM if an event has been finished or not.
If you want the second script to be executed right after the first one is triggered, then you need your second script to check your first script's flag.
Here's an example...

First Script...
Code:
#dynamic 0x800000

#org @start
lock
faceplayer
checkflag 0x200
if 0x1 goto @done
message @1 0x6
setflag 0x200 [COLOR="Red"]<---this will tell the ROM that your first script has been set/executed, so your second script will know.[/COLOR]
release
end

#org @done
message @2 0x6
release
end

#org @1
= Hello.

#org @2
= Um...\nI said hello already...

Second Script...
Code:
#dynamic 0x801000

#org @start
lock
faceplayer
checkflag 0x201 [COLOR="red"]<---this is the second script's flag.[/COLOR]
if 0x1 goto @done
checkflag 0x200 [COLOR="Red"]<---this is the flag of the first script.[/COLOR]
if 0x1 goto @talked [COLOR="Red"]<---if the first script's flag has been set/executed, then the second script will go to the [COLOR="Blue"]@talked[/COLOR] address[/COLOR]
message @1 0x6 [COLOR="Red"]<---if the first script's flag was not yet set, the second script will proceed here.[/COLOR]
release
end

#org @talked
message @2 0x6
setflag 0x201
release
end

#org @done
message @3 0x6
release
end

#org @1
= Go talk to that guy over there.

#org @2
= Wow...\nYou actually talked to him?\lThat takes some guts.

#org @3
= Really...\nThat takes some guts, kid.

In the sample scripts I provided, you can notice that there are two checkflag commands in the second script.
Remember that you should only use flags that the ROM isn't using.

And now, for your script...
Your first script has no setflag command-specifically, setflag 0x120, that will indicate that the script has just been executed.
Your second script, use this at the beginning part...
Code:
#dynamic 0x800DE5

#org @start
lockall
[COLOR="blue"]checkflag 0x121
if 0x1 goto @done[/COLOR]
checkflag 0x120
if 0x0 goto @done [COLOR="Red"]<---this will tell the ROM that if the first script was not yet done/triggered/executed/set, then the script will go to the [COLOR="Blue"]@done[/COLOR] address.[/COLOR]
applymovement 0xFF @move1
waitmovement 0x0
...

At the end part of your script...
Code:
...
applymovement 0x7F @move5
waitmovement 0x0
msgbox @talk3 0x6
special 0x114
[COLOR="blue"]setflag 0x121[/COLOR]
releaseall
end

And then, for crying out loud, remove the clearflag command in your @done address.
Only use that said command if you want the script to repeat itself.
In your script, I don't think you want your first script to be repeated over and over every time the player steps on your second script tile/s.
 
90
Posts
11
Years
  • Seen Aug 21, 2013
Okay got it to work I'll bookmark this If I have any other problems with flags. :pirate:
 
Last edited:

dcjboi

With Quiet Courage
427
Posts
13
Years
  • Seen Sep 27, 2022
I'm having major trouble with this script. I want It to give an option to pick up the pokemon and the thing is the message wont show it just gives the pokemon
Code:
'-----------------------
#org 0x800000
checkflag 0x228
if 0x0 goto 0x8800061
msgbox 0x880006A '"It's an injured Pokemon.\n Should I..."
checkflag 0x228
if 0x0 goto 0x8800023
msgbox 0x88000A0 '"That's okay.\pI'm sure someone else..."
release
end

'-----------------------
#org 0x800061
msgbox 0x88000D4 '"blackkfrrYou received a Charmander!"
release
end

'-----------------------
#org 0x800023
givepokemon 0xC5 0x5 0x0 0x0 0x0 0x0
fanfare 0x13E
msgbox 0x88000D4 '"blackkfrrYou received a Charmander!"
waitfanfare
closeonkeypress
setflag 0x828
msgbox 0x88000FA '"blackkfrrWould you like to give a\n..."
checkflag 0x228
if 0x0 call 0x880005A
msgbox 0x8800137 '"I should take it to a/n Pokemon Cen..."
setflag 0x228
release
end

'-----------------------
#org 0x80005A
call 0x81A74EB
return

'-----------------------
#org 0x1A74EB
fadescreen 0x1
special 0x9E
waitstate
return

'---------
#org 0x80006A
= It's an injured Pokemon.\n Should I take It with me?

#org 0x8000A0
= That's okay.\pI'm sure someone else will\ntake it.

#org 0x8000D4
= blackkfrrYou received a Charmander!

#org 0x8000FA
= blackkfrrWould you like to give a\nnickname to Charmander?

#org 0x800137
= I should take it to a/n Pokemon Center.
 

tajaros

Hi I'm dawg
855
Posts
12
Years
@dcjboi

Here I edited your script i highlighted the parts that i edited.... :)

#dynamic 0x800000

#org @start
lock
msgbox 0x880006A 0x5 '"It's an injured Pokemon.\n Should I..."
compare 0x800D 0x1
if 0x1 goto 0x800023
compare 0x800D 0x0
if 0x1 goto 0x800061

end

#org 0x800061
msgbox 0x88000A0 0x6 '"That's okay.\pI'm sure someone else..."
release
end

#org 0x800023
givepokemon 0xC5 0x5 0x0 0x0 0x0 0x0
fanfare 0x13E
msgbox 0x88000D4 0x6
waitfanfare
closeonkeypress
setflag 0x828
msgbox 0x88000FA 0x5
compare 0x800D 0x1
if 0x1 goto 0x80005A
compare 0x800D 0x0
if 0x1 goto @continue
release

end

#org @continue
msgbox 0x8800137 0x6 '"I should take it to a/n Pokemon Cen..."
hidesprite 0x(Person Event no.)
setflag 0x228
release
end

#org 0x80005A
call 0x81A74EB
return

#org 0x1A74EB
fadescreen 0x1
special 0x9E
waitstate
goto @continue

#org 0x80006A
= It's an injured Pokemon.\n Should I take It with me?

#org 0x8000A0
= That's okay.\pI'm sure someone else will\ntake it.

#org 0x8000D4
= [black_fr]You received a Charmander!

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

#org 0x800137
= I should take it to a/n Pokemon Center.

You didn't put any msgbox codes in it that's why it didn't worked....

msgbox codes

0x2 - Normal msgbox that automatically has faceplayer
0x3 - Signpost msgbox
0x4 - Normal msgbox
0x5 - Yes\No msgbox
0x6 - Normal msgbox


hidesprite 0x(Person event. no.) - hides the sprite

Try putting this script on a POKE BALL with a flag of 228 and input it's person event no. in the hidesprite..... :D

Hope this helps.. :D
 

Renegade

Time for real life...
995
Posts
12
Years
I'm having a strange problem with this script. Everything works, except for the "warp" command at the end. When it "warps" me, the screen fades to black and then nothing happens. (Like the game freezes on a black screen and doesn't go to map 3.46) Help please?

Code:
#dynamic 0x800120

#org @start
lock
textcolor 0x0
message @t1 4
closeonkeypress
applymovement 0xFF @m2
waitmovement 0x0
applymovement 4 @m1
waitmovement 0x0
applymovement 0xFF @m3
waitmovement 0x0
message @t2 6
applymovement 4 @m4
applymovement 0xFF @m5
waitmovement 0x0
message @t3 6
applymovement 5 @m6
applymovement 6 @m6
waitmovement 0x0
playsong 0x112 0x0
setweather 0x3
doweather
applymovement 5 @m7
applymovement 6 @m7
message @t4 6
message @t5 6
applymovement 5 @m8
applymovement 6 @m8
waitmovement 0x0
message @t6 6
applymovement 5 @m9
applymovement 6 @m9
message @t7 4
waitmovement 0x0
fadescreen 0x1
hidesprite 0x04
setflag 0x1203
hidesprite 0x05
setflag 0x1204
hidesprite 0x06
setflag 0x1205
fadescreen 0x0
warp 0x3 0x46 0xFF 0x0C 0x0C
setvar 0x6004 0x0001
release
end

#org @t1
= ???: Hey! \v\h01!

#org @m1
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1E
#raw 0xFE

#org @m2
#raw 0x3
#raw 0xFE

#org @m3
#raw 0x0
#raw 0xFE

#org @t2
= \v\h06: I was wondering when\nyou would wake up.\pI want to head over to Professor\nOak's place and ask if I can have my\lPokèmon yet. We can go together!\pCome on!

#org @m4
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x62
#raw 0xFE

#org @m5
#raw 0x10
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x62
#raw 0x11
#raw 0x13
#raw 0xFE

#org @t3
= \v\h06: Who are those people...?

#org @m6
#raw 0x62
#raw 0x2
#raw 0xFE

#org @m7
#raw 0x12
#raw 0x12
#raw 0xFE

#org @t4
= Man: Hm? What do you kids want?\pAre you eavesdropping on us?

#org @t5
= \v\h06: No. I mean, uhh...

#org @m8
#raw 0x23
#raw 0xFE

#org @t6
= Man: Enough! Take them away,\nGrunt!

#org @m9
#raw 0x1F
#raw 0x1F
#raw 0xFE

#org @t7
= \v\h06: Wait!
 

tajaros

Hi I'm dawg
855
Posts
12
Years
I'm having a strange problem with this script. Everything works, except for the "warp" command at the end. When it "warps" me, the screen fades to black and then nothing happens. (Like the game freezes on a black screen and doesn't go to map 3.46) Help please?

Code:
#dynamic 0x800120

#org @start
lock
textcolor 0x0
message @t1 4
closeonkeypress
applymovement 0xFF @m2
waitmovement 0x0
applymovement 4 @m1
waitmovement 0x0
applymovement 0xFF @m3
waitmovement 0x0
message @t2 6
applymovement 4 @m4
applymovement 0xFF @m5
waitmovement 0x0
message @t3 6
applymovement 5 @m6
applymovement 6 @m6
waitmovement 0x0
playsong 0x112 0x0
setweather 0x3
doweather
applymovement 5 @m7
applymovement 6 @m7
message @t4 6
message @t5 6
applymovement 5 @m8
applymovement 6 @m8
waitmovement 0x0
message @t6 6
applymovement 5 @m9
applymovement 6 @m9
message @t7 4
waitmovement 0x0
fadescreen 0x1
hidesprite 0x04
setflag 0x1203
hidesprite 0x05
setflag 0x1204
hidesprite 0x06
setflag 0x1205
fadescreen 0x0
warp 0x3 0x46 0xFF 0x0C 0x0C
setvar 0x6004 0x0001
release
end

#org @t1
= ???: Hey! \v\h01!

#org @m1
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1F
#raw 0x1E
#raw 0xFE

#org @m2
#raw 0x3
#raw 0xFE

#org @m3
#raw 0x0
#raw 0xFE

#org @t2
= \v\h06: I was wondering when\nyou would wake up.\pI want to head over to Professor\nOak's place and ask if I can have my\lPokèmon yet. We can go together!\pCome on!

#org @m4
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x62
#raw 0xFE

#org @m5
#raw 0x10
#raw 0x10
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x62
#raw 0x11
#raw 0x13
#raw 0xFE

#org @t3
= \v\h06: Who are those people...?

#org @m6
#raw 0x62
#raw 0x2
#raw 0xFE

#org @m7
#raw 0x12
#raw 0x12
#raw 0xFE

#org @t4
= Man: Hm? What do you kids want?\pAre you eavesdropping on us?

#org @t5
= \v\h06: No. I mean, uhh...

#org @m8
#raw 0x23
#raw 0xFE

#org @t6
= Man: Enough! Take them away,\nGrunt!

#org @m9
#raw 0x1F
#raw 0x1F
#raw 0xFE

#org @t7
= \v\h06: Wait!

Like i told you in thethethe;s tut just they're on HEX!
That means it should be 0x2E!

So your warp code will be warp 0x3 0x2E 0xFF 0x0C 0x0C!

Hex is like this

1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
11
12
13
14
15
16
17
18
19
1A
1B
.........And so on.... you use XSE so just use the converter there... :)
 

Renegade

Time for real life...
995
Posts
12
Years
Like i told you in thethethe;s tut just they're on HEX!
That means it should be 0x2E!

So your warp code will be warp 0x3 0x2E 0xFF 0x0C 0x0C!

Hex is like this

1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
11
12
13
14
15
16
17
18
19
1A
1B
.........And so on.... you use XSE so just use the converter there... :)

Oh, lol. Forgot :/ Thanks though!
 
Last edited:

vladi1q1

Mapper 7/10
48
Posts
16
Years
Game: Pokemon Ruby
Program: XSE
Problem: I put it as a tile in Advanced-Map but when I enter in game and step on it the game freezes.
Code:
Code:
'-----------------------
#org 0x6B1840
lockall
msgbox 0x86B1862 '"Lady: You shouldn't go in the\nfore..."
callstd 0x4
closeonkeypress
applymovement MOVE_PLAYER 0x86B189F
waitmovement 0x0
releaseall
end


'-----------
' Movements
'-----------
#org 0x6B189F
#raw 8 'Step Down (Normal)
#raw FE 'End of Movements


'---------
' Strings
'---------
#org 0x6B1862
= Lady: You shouldn't go in the\nforest yet.
 

Renegade

Time for real life...
995
Posts
12
Years
Game: Pokemon Ruby
Program: XSE
Problem: I put it as a tile in Advanced-Map but when I enter in game and step on it the game freezes.
Code:
Code:
'-----------------------
#org 0x6B1840
lockall
msgbox 0x86B1862 '"Lady: You shouldn't go in the\nfore..."
callstd 0x4
closeonkeypress
applymovement MOVE_PLAYER 0x86B189F
waitmovement 0x0
releaseall
end

'-----------
' Movements
'-----------
#org 0x6B189F
#raw 8 'Step Down (Normal)
#raw FE 'End of Movements


'---------
' Strings
'---------
#org 0x6B1862
= Lady: You shouldn't go in the\nforest yet.


There is an absence of a "setvar" command at the end of the script. If you don't know about this, there are several tutorials on vars in the tutorials section.
 
9
Posts
11
Years
  • Seen Jul 10, 2012
Honestly, Im confused, I make a new event, now how Do i add my own script to that event? I need all steps please

Its Fire Red btw
 

Renegade

Time for real life...
995
Posts
12
Years
Honestly, Im confused, I make a new event, now how Do i add my own script to that event? I need all steps please

Its Fire Red btw

So you don't know about scripting at all? I suggest you practice and start with the basics in the tutorials section or something...
 
9
Posts
11
Years
  • Seen Jul 10, 2012
Ive read the tutorial twice through, and Im still a little confused, how would I go abput making a new script? I know what to write, just not how to assign it to a new event
 
5
Posts
11
Years
hey im new to script writing and ive been having problems, the first script i wrote was a basic one and that seemed to work fine, but then i wrote a yes/no script and problems arose.... whenever i pressed compile it said: unknown keyword 'lock' at line 4

can anyone help a noob out??
 

Renegade

Time for real life...
995
Posts
12
Years
hey im new to script writing and ive been having problems, the first script i wrote was a basic one and that seemed to work fine, but then i wrote a yes/no script and problems arose.... whenever i pressed compile it said: unknown keyword 'lock' at line 4

can anyone help a noob out??

Can you provide the coding you did?
 

tajaros

Hi I'm dawg
855
Posts
12
Years
hey im new to script writing and ive been having problems, the first script i wrote was a basic one and that seemed to work fine, but then i wrote a yes/no script and problems arose.... whenever i pressed compile it said: unknown keyword 'lock' at line 4

can anyone help a noob out??

We can't help you accurately if you don't post your script...

Try retyping the script over again you might have misspelled a command or something here's some that might happen to your script...

#dynamic 0x800000

#org @script
[]lock <--- You might have type something wrong

If that's not your problem try double checking your script for commands errors... :)
 
5
Posts
11
Years
#dynamic 0x800000

#org @start
lock
faceplayer
message @tutorial
boxset 5
compare LASTRESULT 1
if b_true goto @yes
compare LASTRESULT 0
if b_true goto @no
release
end

#org @tutorial
= Yes or no?

#org @yes
message @pressyes
boxset 6
release
end

#org @no
message @pressno
boxset 6
release
end

that was the script i used, then i tried a basic script again and the same problem arose again, even though i used the same script as before (that worked before too) here it is

#dynamic 0x2DD100

#org @start
lock
faceplayer
msgbox @script 0x6
release
end

#org @script
= Hey!\nYou are welcome to PALLET TOWN
 

ADLFM14

Legendary Spriter
42
Posts
11
Years
i just wanted to ask if there is a command in any script which fades screen and replace an OW Sprite with another and thnx you are always my leader in rom hacking.
 

Renegade

Time for real life...
995
Posts
12
Years
i just wanted to ask if there is a command in any script which fades screen and replace an OW Sprite with another and thnx you are always my leader in rom hacking.

You could, while the screen is faded, do a "hidesprite" command on the sprite you want to remove then a "showsprite" command on another person. Then when the screen fades into the normal view it will look like a character transformed or something.
 
Status
Not open for further replies.
Back
Top