Advertiser Content

Tool PKSV - Pokémon Script Editor + GUI

Started by score_under November 19th, 2007 2:13 PM
  • 389688 views
  • 821 replies

score_under

I program the *other* ASM.

Age 26
Hertfordshire, England
Seen December 8th, 2015
Posted August 10th, 2010
525 posts
13.9 Years
I am no longer active on these forums; if you need to contact me please use e-mail unless your name is Seth in which case please run a virus scan first. I probably won't develop this tool any more, you can steal the code or something.

Works in: Pokemon Gold, Pokemon Silver, Pokemon Crystal, Pokemon Fire Red, Pokemon Leaf Green, Pokemon Emerald, Pokemon Ruby, and Pokemon Sapphire. (Now dynamic offsets work in Gold too)


Most of the posts on the first page (except this one) that I have made are for the old command-line version.
If you don't have a webkit-based (e.g. Safari), Mozilla-based (e.g. Firefox), or css3-compliant browser, get firefox now as this page's CSS renders well ONLY in one or more of these conditions. If you use, for example, Internet Explorer, it will not display correctly.

Simple Guide Here
Beginners only - PKSV is so much more than this!


Warning: Never use #org $1 (or similar pokescript parlance), as it will write to position 1 in the ROM and corrupt vital data.
Get it at http://pk-script-view.sourceforge.net/.


Simply put, PKSV is a Pokémon Advance script editor. A very good one...
One you will instantly get hooked on - It's only a matter of time before you download!
The package you most probably want is the package with GUI.
Here's how it looks:

Anyone with spare time, a brain, and a sharp eye for bugs can develop it if they want - I give away ALL the source code in the download link!

I have developed this program in my free time because I found that Rubikon and PokeScript weren't advanced enough to suit my needs. This program will also automatically notify you of updates [version data] whenever they're available.

Two of the most unique features about this program:
  • It compiles movements into easy-to-read movement lists, not #raw!
  • It has a built in script generator! (But I'll need some more people to give me ideas about some other simple scripts that I could generate!)
  • Heck, you can even zoom in and out with ctrl+mouse wheel. (Or indeed, ctrl+numpad+ and ctrl+numpad- respectively)

How to install:
Use an unzipping program (if you don't have EITHER Windows XP OR one of these, do a google search for AlZip) to unzip the file you downloaded (usually pksvui_pkg?-?-?.zip).
Unzip it into its own folder and when you are happy with the place you have put it, double-click "AssociateShell.bat" to register PKSV in its current folder with your system.
Now all you have to do is run "pksvui.exe" and play around!


(If you're interested in how Gold #dynamic works, look here)
Spoiler:
#dyn findfromgold
#org @test
loadfont
2writetext :test
yesorno
2ptjump :asd
:test
= Testing\nTest1\e
:asd
#3ptr @zzzz
#org @zzzz
3writetext @asdf
3jump @yyyy
#org @yyyy
end

#org @asdf
= Message 2\e
Notice that 2-byte pointers use :labels and 3-byte pointers use @blocks. This is because "#org" blocks will never cross a bank, so a label inside them ensures it will be able to use a 2-byte pointer safely. You cannot use labels for 3-byte commands, unfortunately, you will have to use a code block.


Please reply if you like it!
...or rate this thread, or add reputation to this post, or PM me with hate, or add to my visitor messages.

Tech stuff:
Spoiler:
PKSV is a GPL-licenced decompiler and compiler for Pokémon Advance ROMs, currently with only one developer - me!
There are 2 executables: pksvui.exe is the frontend (the graphical IDE) and pksv.exe is the backend.
It is programmed in a mixture of C and ASM, and compiled with Visual C++.

score_under

I program the *other* ASM.

Age 26
Hertfordshire, England
Seen December 8th, 2015
Posted August 10th, 2010
525 posts
13.9 Years
This post applies to an OLD version of the program only
Spoiler:


Now it does even more: recompiles strings! I should have had this 2 days ago, but sourceforge didn't like the package.

@ D-Trogh:
It can decompile most scripts without problems, and makes a Clear Distinction between pause and pauseevent, while rubikon labels them as just pause *ambiguous*.
It also makes a distinction between msgbox (part of loadpointer) and message (something else to do with berry script, same effect).
And it doesn't forget to apply #org to any movement data. Shame on Rubikon!

@ Everyone!
UPDATE: Example script for storetext!
#org 0x6B09F8
lock
faceplayer
checkflag 0xE000
if 0x1 jump 0x6b0C50
jump 0x6b0C30

#org 0x6B0B00
= Dude, where's my \v\h02?\p...

#org 0x6b0C00
= car

#org 0x6b0C10
= burrito of doom?!

#org 0x6b0c30
setflag 0xE000
storetext 0x0 0x86b0C00 'storetext 0x0 ADDR means store ADDR into \v\h02.
                        'likewise, storetext 0x1 ADDR means store ADDR into \v\h03.
                        'storetext 0x50 ADDR means store ADDR into \v\h52.
                        'Get it?
jump 0x6b0d00

#org 0x6b0c50
clearflag 0xE000
storetext 0x0 0x86b0c10
jump 0x6b0d00

#org 0x6b0d00
message 0x6B0B00
showmsg
waitbutton
closemsg
release
end
Now just assign some guy to 0x6B09F8 in advancemap, and he says:
* Dude, where's my car?
and
* Dude, where's my burrito of doom?
in an alternating pattern.

Edit #1 000 000 000 or something like that :D
Use storevar to store a var as text.
EG. If 0x800D contains 0xC, storevar 0x0 0x800D will store the text "12" into text-var \v\h02.
Plz not to PM me, I don't come here often enough. Email if you need me
Age 26
Male
Wherever I am, I am
Seen October 9th, 2016
Posted April 2nd, 2011
70 posts
11.4 Years
I understand how to work the program, but I'm not sure how to change the scripts.

When I open it it comes up with a strange black box, then gives a prompt to open the ROM.
After that it asks for an offset. So I put it in and it comes up with the offset I asked for. But then if I hit any button it clicks out.

Help?

Berries Grow, Birds Fly, Sun Shines, and Brotha...I Splash People.

Swampert 22

Is making tools for you...

Age 28
Male
Switzerland
Seen April 23rd, 2013
Posted November 26th, 2011
393 posts
13.8 Years
An offset is the point in the rom where the data you want is stored. To find an offset, go into advance map and click on an event. It should then, in the address box have $XXXXXX.
X obviously being a number. Remember that offset, than put it into PKSV. Then it will decompile the script at that offset.

I've made some tools for Pokémon hacking! Please check out the thread... Swampert Tools Showcase

Head over to my thread to check out my latest tool, Pokémon Red/Blue Trainer Editor!

Visit my site for Pokémon ROM Hacking tools! Swampert Tools Homepage
Age 24
Enjoying life
Seen January 12th, 2012
Posted February 26th, 2008
214 posts
11.6 Years
thanks, never could have guess that stuff. but there is still a problem. it is that when i type the offset, then it will say "enter hex number! (Too late now!) what is that suppose to mean?
Totreial ok go to advanced map then click on a event it should have an offset fill that in without th $

score_under

I program the *other* ASM.

Age 26
Hertfordshire, England
Seen December 8th, 2015
Posted August 10th, 2010
525 posts
13.9 Years
This post applies to an OLD version of the program only
Hey, I was wondering how to compile scripts with this program? If it's possible.
Save the file as a .PKS file, right-click it, then press Compile. <- NOT USED IN PKSV 2.0 (This was used before v0.9)

Old version of post:
Spoiler:
Sorry for the inactivity.
Hey, I was wondering how to compile scripts with this program? If it's possible.
Go to command prompt and CD to the PKSV directory, then type...
pksv -r script.txt rom.gba
I've just started working on it again - working on getting it to decompile slot-machine scripts. (eg. buying coins, using slots). I've been testing on ruby.
Plz not to PM me, I don't come here often enough. Email if you need me

Swampert 22

Is making tools for you...

Age 28
Male
Switzerland
Seen April 23rd, 2013
Posted November 26th, 2011
393 posts
13.8 Years
Hey score-under, I had an idea that may make a useful addition to the program. Functionality to export the decompiled script to a txt file. Whadda ya think, cus sometimes, on a really long script it chops the top off. This would let you read the whole thing, and make basing new scripts on the decoded ones easier.

Just an idea!

I've made some tools for Pokémon hacking! Please check out the thread... Swampert Tools Showcase

Head over to my thread to check out my latest tool, Pokémon Red/Blue Trainer Editor!

Visit my site for Pokémon ROM Hacking tools! Swampert Tools Homepage

score_under

I program the *other* ASM.

Age 26
Hertfordshire, England
Seen December 8th, 2015
Posted August 10th, 2010
525 posts
13.9 Years
This post applies to an OLD version of the program only

Old post:
Spoiler:
OK, but to do this at the moment, I do:
pksv ruby.gba ABCDEF > script.txt
Check here to see some of my compiler woes implementing the feature:
Spoiler:

EDIT:
Compiler blues atm :(
In file included from codeproc.h:182,
                 from pksv.c:28:
decompiler.h: In function `writescr':
decompiler.h:50: error: syntax error before "va_list"
decompiler.h: In function `DecodeProc':
decompiler.h:73: warning: assignment from incompatible pointer type
Fixed with a simple replacement of va_list with va_arg (simple mistake)
and placing (typeof(func)) before one of the lines.
Now, I'm getting:
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s: Assembler messages:
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2681: Error: ambiguous operand size for `cmp'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2683: Error: ambiguous operand size for `dec'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2686: Error: no such instruction: `movl -16(%ebp),%edx'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2687: Error: no such instruction: `leal -16(%ebp),%eax'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2688: Error: no such instruction: `addl $4,(%eax)'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2689: Error: no such instruction: `movl (%edx),%eax'
C:\DOCUME~1\Charles\LOCALS~1\Temp/ccmybaaa.s:2690: Error: no such instruction: `movl %eax,-65564(%ebp)'
EDIT:
All solved with vsprintf. Good old vsprintf. Also freed about 6 bytes of memory!

New post:

Hey people! I got a new version out today.
It can decompile codes for the slot-machine much better now, with commands for altering and checking the coin case, and some purely semantic commands (to prevent false data being decompiled).
The unknown commands are prefixed with a "CMD_" both in the program AND in the decompiled code, and are useless until I find out what they actually do :D
@swampert22: This version can now do that!

EDIT:

Random no-confirmation trading script
setvar 0x8004 0x0 ' Their poke, slot number (still don't know the variable for trainer)
setvar 0x8005 0x0 ' Our poke, slot number [0-5]
special 0xfd
special 0xfe
waitspecial
Plz not to PM me, I don't come here often enough. Email if you need me

Lyzo

Back from vacation

Age 24
Male
The Netherlands
Seen 1 Day Ago
Posted 1 Day Ago
258 posts
12.3 Years
Hey I've been trying to get the poké ball script because i still don't know how it works anyway the program worked but it says all these weird things that i don't get.

Here's what it says if anyone knows what it means please tell me.

copyvarifnotzero 0x8000 0x148
copyvarifnotzero 0x8001 0x1
callstd MSG_FIND ' PLAYER found one XXXXXX!
end


I think i understand the last 2 sentences. It plays a message just like the code message $**** and then the message. Then it ends. But i don't understand the first 2.

score_under

I program the *other* ASM.

Age 26
Hertfordshire, England
Seen December 8th, 2015
Posted August 10th, 2010
525 posts
13.9 Years
This post applies to an OLD version of the program only

Hi,
copyvarifnotzero 0x8000 0x148
copyvarifnotzero 0x8001 0x1
When you find/obtain an item, the game needs to know which item and how much.
The number stored in 0x8000 tells it which item (0x148 = TM40 Aerial Ace)
The number stored in 0x8001 tells it how many (one)
then it calls the function to give the item (callstd MSG_FIND) and ends the script.

Also, be careful not to mix up message and msgbox in pksv - they mean different things.
message 0x????????  ' Gets ready to show a message (only one page, ie. cannot have \p or \l)
showmsg
waitbutton
closemsg
end

--------------

msgbox 0x???????? 'can have multiple pages
callstd MSG_NORMAL 'shows message
end
message 0x???????? is used primarily in the "berry" script, as it provides more control over when the message closes, what it does, etc.
msgbox 0x???????? is used for general-purpose messages.

How to edit scripts
This is a copy of a PM I sent - I hope it's useful to you.
Spoiler:

I understand how to work the program, but I'm not sure how to change the scripts.

When I open it it comes up with a strange black box, then gives a prompt to open the ROM.
After that it asks for an offset. So I put it in and it comes up with the offset I asked for. But then if I hit any button it clicks out.

Help?
Sorry for being a bit ;) late, but if you're still at a loss, here's how to do it:

Save this as EditScript[NAME].bat (or something you can remember) EDIT: You need to put .bat on the end or it does not work!
@echo off
pksv ROMFILE.GBA OFFSET >edit_script
notepad edit_script
pksv -r edit_script ROMFILE.GBA
For example:
EditScript[Berry].bat
@echo off
pksv RubyRom.gba 1A14DD >edit_script
notepad edit_script
pksv -r edit_script RubyRom.gba
Then, move the EditScript[NAME].bat file into the PKSV folder (along with the ROM, if you don't know how to change BAT-files accordingly)
Now, double-click your .bat file and it should open notepad. Change the script in there, and as soon as you save and exit notepad, it will compile your script.

The 1st PKSV command chooses the ROM and offset, and decompiles it.
The last PKSV command chooses the ROM and script, and compiles it again.
ps. only 25% of people download this from pokecommunity.com - the rest come from pokecommunity.com
Plz not to PM me, I don't come here often enough. Email if you need me
Advertiser Content