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

Edward Newgate

Everyone is a child of the sea
274
Posts
12
Years
Differences between goto and call?

Goto is used to call another part in the same script
(Like with the checkflag command:
If 0x1 goto @right
Or
If 0x0 goto @left)

Call is used to call (a part of) a different script saved in the rom
(Comes down to: call 0x800000, to call the script stored at offset 800000
 

ep!c

Banned
124
Posts
11
Years
  • Seen Jan 4, 2015
Wrong.
The difference between Goto and Call is, that you can return a call.
Example.

if 0x1 goto @offset

#org @offset
end

Example2.

if 0x1 call @offset
end

#org @offset
return

It will return to end or whatever you write after "if 0x1 call @offset"
 
61
Posts
10
Years
  • Age 37
  • Seen Nov 8, 2015
Does anyone know what "rst 28" (GBC) does? It's rather important as it's a source of a glitch occurring with my hack.

EDIT: Nevermind, found it... wow, the code was a mess! I think I found where I accidentally injected code to the wrong address in the Script Editor... messed up the ASM badly.
 
Last edited:

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Differences between goto and call?

An example script...
Code:
#org @start
lock
faceplayer
call @free
checkflag 0x800
if 0x1 goto @done
message @1 0x6
givepokemon 0x4 0x5 0x0
message @2 0x6
setflag 0x800
release
end

#org @1
= Here's a Charmander for you!

#org @done
message @2 0x6
release
end

#org @2
= Take good care of Charmander!

#org @free
message @3 0x6
return

#org @3
= Charmanders, are great, no?

goto will go to a new address and will not return to where it came from. The script will not work properly if the 'goto' address has a 'return' code in it.
call will go to a new address and will return back to where it left off with the 'return' code.
 

Eren Jaeger

Pianoist
151
Posts
11
Years
How does hidesprite work on setvar script?
I've made a setvar script but it doesn't need flags right?
But without a flag hidesprite won't work, I tried to put the setvar's flag which is 5000.
But my sprite is nowhere to be seen and after the script, the whole game hangs.

this is my script.
Spoiler:
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
How does hidesprite work on setvar script?
I've made a setvar script but it doesn't need flags right?
But without a flag hidesprite won't work, I tried to put the setvar's flag which is 5000.

simple...add a flag. =/
I'm still a newbie at vars though, so I can't really see any other ways to hide an NPC aside from flags or level scripts.


But my sprite is nowhere to be seen and after the script, the whole game hangs.

That's because you forgot this...
Code:
#org @move3
#raw 0x56
#raw 0x00
[COLOR="Red"]#raw 0xFE[/COLOR]
 

Eren Jaeger

Pianoist
151
Posts
11
Years
simple...add a flag. =/
I'm still a newbie at vars though, so I can't really see any other ways to hide an NPC aside from flags or level scripts.




That's because you forgot this...
Code:
#org @move3
#raw 0x56
#raw 0x00
[COLOR=Red]#raw 0xFE[/COLOR]

Thanks, my gf just said why my script went wrong.
You always got the answer to my problems. lol

I don't get it!
I did everything correctly.

I inserted this script on the green "S"
Spoiler:


and change the var number to 4050 and unknown to 300
and the script has a check & setflag! but the script
keeps repeating when I step on it? What the hell.
 
Last edited:

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
I don't get it!
I did everything correctly.

I inserted this script on the green "S"
Spoiler:


and change the var number to 4050 and unknown to 300
and the script has a check & setflag! but the script
keeps repeating when I step on it? What the hell.

fixes are in red.

Code:
#dynamic 0x800000

#org @start
checkflag 0x8D6
[COLOR="Red"]if 0x1 goto @done[/COLOR]
applymovement 0xFF @move
waitmovement 0x0
playsong 0x1F4 0x0
special 0x116
applymovement 0x7F @camera
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move1
waitmovement 0x0
hidesprite 0x1
applymovement 0x7F @camera1
waitmovement 0x0
special 0x117
fadesong 0x169
setflag 0x8D6
release
end

[COLOR="red"]#org @done
release
end[/COLOR]

#org @1
= [red_em]?????[darkgrey_em]: Soma had been captured.\nThis is bad, I better hurry now.

#org @move
#raw 0x56
#raw 0xFE

#org @camera
#raw 0x0B 
#raw 0x0B
#raw 0x0B
#raw 0xFE 

#org @move1
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0xFE 

#org @camera1
#raw 0xA
#raw 0xA 
#raw 0xA 
#raw 0xFE
 

Teh Blazer

Divider of Zero
776
Posts
15
Years
I made a givepokemon script and it works fine when I want to nickname the given pokemon when it's on my team, but when it's boxed the nickname thing nicknames the last pokemon I have instead of the given pokemon.

What commands do I need to use so the nickname feature works on the pokemon even if it's sent to the box?
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
I made a givepokemon script and it works fine when I want to nickname the given pokemon when it's on my team, but when it's boxed the nickname thing nicknames the last pokemon I have instead of the given pokemon.

What commands do I need to use so the nickname feature works on the pokemon even if it's sent to the box?

You don't. That is why the game always checked to make sure that you had room for a pokemon before giving you one. Include those checks in the script and you will be fine.
 

ep!c

Banned
124
Posts
11
Years
  • Seen Jan 4, 2015
fixes are in red.

Code:
#dynamic 0x800000

#org @start
checkflag 0x8D6
[COLOR=Red]if 0x1 goto @done[/COLOR]
applymovement 0xFF @move
waitmovement 0x0
playsong 0x1F4 0x0
special 0x116
applymovement 0x7F @camera
waitmovement 0x0
msgbox @1 0x6
applymovement 0x1 @move1
waitmovement 0x0
hidesprite 0x1
applymovement 0x7F @camera1
waitmovement 0x0
special 0x117
fadesong 0x169
setflag 0x8D6
release
end

[COLOR=red]#org @done
release
end[/COLOR]

#org @1
= [red_em]?????[darkgrey_em]: Soma had been captured.\nThis is bad, I better hurry now.

#org @move
#raw 0x56
#raw 0xFE

#org @camera
#raw 0x0B 
#raw 0x0B
#raw 0x0B
#raw 0xFE 

#org @move1
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0x0B 
#raw 0xFE 

#org @camera1
#raw 0xA
#raw 0xA 
#raw 0xA 
#raw 0xFE

Gosh, destinja, this is a terrible scripting style!!
Throw this checkflag thingie away.. it's awful plz.
Set your variable in advancemap to a free one (i use 5000+), value = 0.
Set in the script this variable you used in advancemap, but value = 1 (setvar 0xXYZQ 0x1)
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Gosh, destinja, this is a terrible scripting style!!
Throw this checkflag thingie away.. it's awful plz.
Set your variable in advancemap to a free one (i use 5000+), value = 0.
Set in the script this variable you used in advancemap, but value = 1 (setvar 0xXYZQ 0x1)

YOUR RESPONSE IS TERRIBLE. Not DJG's scripting.

Those vars. 5000+? Really? Those are in PC box space. Do you really want bad eggs? Look bro, DJG knows what to do. This method is safe. Yours is not.

I think you need to read this: http://www.pokemonhackersonline.com/showthread.php?t=14110

Even though you've been hacking longer than me, and maybe DJG, a lot has been learned about what is safe and what isn't while you weren't hacking.
 

Satoshi Ookami

Memento Mori
14,254
Posts
15
Years
Gosh, destinja, this is a terrible scripting style!!
Throw this checkflag thingie away.. it's awful plz.
Set your variable in advancemap to a free one (i use 5000+), value = 0.
Set in the script this variable you used in advancemap, but value = 1 (setvar 0xXYZQ 0x1)
Da... heck...?
1) No one will take you seriously if you write like that plz... just 'cause it's cool plz!
2) You should suggest this to the poster, not DJG.
3) Poster wanted help with script where he explicitly used the "checkflag" command so DJG fixed his script.
 

daniilS

busy trying to do stuff not done yet
409
Posts
10
Years
  • Age 24
  • Seen Jan 29, 2024
I know some scripting commands support a word OR a variable as an argument. In the case of a variable, how should I write that?
 
945
Posts
11
Years
@DaniilS, words? are you talking about buffers?
Spoiler:

is the equivalent of
Spoiler:
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
I know some scripting commands support a word OR a variable as an argument. In the case of a variable, how should I write that?

@DaniilS, words? are you talking about buffers?
Spoiler:

is the equivalent of
Spoiler:

He is talking about scripts like this:

trainerbattle 0x3 0x4000 etc


Where a var is substituted for a static number. GF used these a lot to make dynamic scripts that saved space. (Though, I noticed that GF OVERuses them in some cases, lol)

Either way, most commands (but not all) accept a var. You see, it does this:

Code:
if arg <= 0x3FFF:
    goto use_number_as_is
else:
    goto use_variable_decrypter

Got it? So, it is the exact same syntax, just using a var instead of a number. The most common example is the givepokemon script:

givepokemon 0x4001 0x5 0x0


At the beginning of the game, when the player is asked which pokemon they want, that choice is set to a temp var (either 0x4001 or 0x4003, can't remember) and then the givepokemon command is called using that var. Basically works like this:

Code:
#org @choose_bulbasaur
setvar 0x4001 0x1
goto @give

#org @choose_charamander
setvar 0x4001 0x4
goto @give

#org @choose_squirtle
setvar 0x4001 0x7
goto @give

#org @give
givepokemon 0x4001 0x5 0x0
 

Rezordaxx

Asks many questions!
290
Posts
10
Years
So the second move script doesnt work but the first does,
the person event number is correct!
could it be because the sprite isnt in the screen?
Or is it to long or something?
I am using a offset of 500 bytes in FireRed JPAN hacked engine

script:
Spoiler:
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
So the second move script doesnt work but the first does,
the person event number is correct!
could it be because the sprite isnt in the screen?
Or is it to long or something?
I am using a offset of 500 bytes in FireRed JPAN hacked engine

script:
Spoiler:

NPC #2 is too far.
Spoiler:

Horizontally, from the player, NPC's should be 8 or 9 tiles away for your script to reach them.
Also, don't forget to add 'waitmovement 0x0' after each of your 'applymovement' commands.
 
Status
Not open for further replies.
Back
Top