The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Other Noob script problem (https://www.pokecommunity.com/showthread.php?t=357524)

JoshTheTrainer October 24th, 2015 5:20 AM

Noob script problem
 
I recently started some scripting for my Fire Red hack. I'm a complete noob in scripting. I'm using PKSV-UI (I'm writing the scripts from scratch so without the auto-script-choose thingie). Now I have the following script:

Spoiler:
#dyn 0x740000
#org @start
lock
faceplayer
checkflag FR_NATIONAL_DEX
if 0x1 goto @alreadyHas
setflag FR_NATIONAL_DEX
fanfare 0x13E
msgbox @installedTxt MSG_NORMAL
waitfanfare
release
end

#org @alreadyHas
msgbox @alreadyHasTxt MSG_NORMAL
release
end

#org @installedTxt
= Okay... I've installed the National Dex!

#org @alreadyHasTxt
= I hope you like the National Dex!


What I want is I talk to some random ass dude, and when I don't have a national dex, giving the national dex (flag FR_NATIONAL_DEX I thought) and showing msgbox, else showing different msgbox.

Now what happens is I talk to the guy, game will freeze for few seconds, no message box is shown and AFAIK I don't get the national dex. I don't know what the problem is.

Sensual October 24th, 2015 7:54 AM

First, you need to assign the script an unused flag (200-2FF are safe to use assuming we're talking FireRed). Having said that, FR_NATIONAL_DEX is not a flag. It's a special that upgrades the basic pokedex to a national dex. You'll want to include that in the part of the script where the checkflag is false (meaning the player doesn't already have the national dex in this case). Also, I personally thinks it better to put the more complicated part of the script into modules (in this case, the parts that upgrades the dex), so I changed 'alreadyHas' to 'doesnothave'. Trust me, it can save some confusion in the long run. It should look more like so:

Spoiler:
#dyn 0x740000
#org @start
lock
faceplayer
checkflag 0x200
if 0x0 goto @doesnothave //if flag is NOT set, go to @doesnothave
msgbox @alreadyHasTxt MSG_NORMAL
release
end

#org @doesnothave
special FR_NATIONAL_DEX
fanfare 0x13E
msgbox @installedTxt MSG_NORMAL
waitfanfare
setflag 0x200
release
end

#org @installedTxt
= Okay... I've installed the National Dex!

#org @alreadyHasTxt
= I hope you like the National Dex!


Let me know if you have any questions about that.

JoshTheTrainer October 24th, 2015 8:09 AM

That works, got the national dex, HOWEVER the messagebox when the dex is given doesn't show up. Neither when I already have it.

Sensual October 24th, 2015 8:19 AM

With PKSV, you have to script your messages like so:

msgbox @installedTxt
callstd MSG_NORMAL

Sorry, I'd forgotten about that. The first part loads it into memory and the second part shows it in memory.

Is there any particular reason you're using PKSV by the way? XSE is better in just about every way.

JoshTheTrainer October 24th, 2015 8:23 AM

Quote:

Originally Posted by Sensual (Post 8975120)
With PKSV, you have to script your messages like so:

msgbox @installedTxt
callstd MSG_NORMAL

Sorry, I'd forgotten about that. The first part loads it into memory and the second part shows it in memory.

Is there any particular reason you're using PKSV by the way? XSE is better in just about every way.

It's an easy program to use and the syntax highlighting helps me out and makes it a bit easier. And IDK if you can do it with XSE but you can decompile scripts from in the game (for example for mart editing)

PokemonValor October 24th, 2015 10:55 AM

Personally I like PKSV better too. I think it's a little more user friendly. XSE might be better when you're dealing with a lot of memory stuff and different offsets but PKSV has some nice features.

Syrex October 24th, 2015 2:51 PM

There is a script help thread, you should post in there instead of creating a whole new topic :3

Either way, I use XSE. Its the standard in rom scripting for pokemon.
I suggest you to use XSE.

Blah October 24th, 2015 5:50 PM

Quote:

Originally Posted by Syrex (Post 8975419)
There is a script help thread, you should post in there instead of creating a whole new topic :3

Either way, I use XSE. Its the standard in rom scripting for pokemon.
I suggest you to use XSE.

XSE is plagued from incorrect documentation in the command help, tutorials by people who don't know what they're talking about, and it cannot compile scripts which are longer than a certain amount of lines. I created a python script who's output was a script to test the movement states for an NPC, and XSE just died hilariously. There's also the fact that the incorrect documentation has also lead to an incorrect convention of using commands. A common one, for example's sake is loadpointer. It does not load a pointer, it just sets some memory in a bank. It seems like Hackmew guessed 80% of the commands he didn't know about, rather than leaving them nameless.

PKSV is broken when it comes to recompiling scripts with callasm, compiling certain money commands and score_under seemed to take some of Hackmew's incorrect command names.

In the end, we're left with two very popular, yet poor scripting programs. Hopefully someone comes along and makes one which is more versatile and multi-platform. I'd love to have a thread about script command research or something. A large chunk of these script commands need name reworking. Also, hopefully in the near future, we can expand the script commands to incorporate a larger command library. Setting up ASM routines in scripts using temporary variables is stupidly bad and takes up more space than it should. Hopefully by the end of this year, we can get something started and move the ROM hacking scene in a better direction. Right now we have newcommers learning incorrect things from incorrect tutorials, and trying out these outdated script editors. Your post clearly illustrates this, as you have no idea about either script editor, yet you're promoting one. We need to fix that.


All times are GMT -8. The time now is 2:23 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.