I HAVE THE EVENT SCRIPT TOLKENS!

  • Thread starter Thread starter halkun
  • Start date Start date
Status
Not open for further replies.
H

halkun

Guest
Good news everyone!

I'm working with lasyan3 and he was able to give me a listing of the Scripting Tolkens (Commands) for the field files.

There are over 200 scripting commands. I don't have thier definitions yet, some are hard to decypher and I haven't even dug through the field files to figure out what section conatins the tokens. (In the PSX version, it's the DAT file, which is split into two parts. The text, and then the script that's executed)

Here's a listing of the scripting commands, you read it like this:

num = name | arg

num is the tolken number (The command code)
name is the name of the command
arg is the legnth of the command including arguments. (For example RET is one command with no arguments, so it's 1)

Here are the commands.....

Code: [Select]
Code:
00 = RET | 101 = REQ | 302 = REQSW | 303 = REQEW | 304 = PREQ | 305 = PRQSW | 306 = PRQEW | 307 = RETTO | 508 = JOIN | 209 = SPLIT | 150A = SPTYE | 60B = GTPYE | 60C =  | 00D =  | 00E = DSKCG | 20F = SPECIAL | 210 = gotoNext +<1> | 211 = gotoNextLong +<2> | 312 = gotoPrev -<1> | 213 = gotoPrevLong -<2> | 314 = if UByte(<1>)[<1>] != <1> then(<1>) goto +<1> | 615 = if UByteL(<1>)[<1>] != <1> then(<1>) gotoLong +<2> | 716 = if SWord(<1>)[<2>] != <2> then(<1>) goto +<1> | 817 = if SWordL(<1>)[<2>] != <2> then(<1>) gotoLong +<2> | 918 = if USWord(<1>)[<2>] != <2> then(<1>) goto +<1> | 819 = if USWordL(<1>)[<2>] != <2> then(<1>) gotoLong +<2> | 91A =  | 01B =  | 01C =  | 01D =  | 01E =  | 01F =  | 020 = MINIGAME | 1121 = TUTOR | 222 = BTMD2 | 523 = BTRLD | 324 = wait( time=<2> ) | 325 = NFADE | 926 = BLINK | 227 = BGMOVIE | 228 = KAWAI | 25529 = KAWIW | 12A = PMOVA | 22B = SLIP | 22C = BGPDH | 52D = BGSCR | 72E = WCLS | 22F = WSIZW | 1030 = IF-KEY | 431 = IF-KEYON | 432 = IF-KEYOF | 433 = UC | 234 = PDIRA | 235 = PTURA | 436 = WSPCL | 537 = WNUMB | 838 = STTIM | 639 = GOLD+ | 63A = GOLD- | 63B = CHGLD | 43C = HMPMAX1 | 13D = HMPMAX2 | 13E = MHMMX | 13F = HMPMAX3 | 140 = message( window=<1>, dialog=<1> ) | 341 = MPARA | 542 = MPRA2 | 643 = MPNAM | 244 =  | 045 = MP+ | 546 =  | 047 = MP- | 548 = ASK | 749 = MENU | 44A = MENU2 | 24B = BTLTB | 24C =  | 04D = HP+ | 54E =  | 04F = HP- | 550 = window( id=<1>, X=<2>, Y=<2>, W=<2>, H=<2> ) | 1051 = WMOVE | 652 = WMODE | 453 = WREST | 254 = WCLSE | 255 = WROW | 356 = GWCOL | 757 = SWCOL | 758 = ST-ITM | 559 = DL-ITM | 55A = CK-ITM | 55B = SM-TRA | 75C = DM-TRA | 85D = CM-TRA | 105E = SHAKE | 85F = NOP | 160 = MAPJUMP | 1061 = SCRLO | 262 = SCRLC | 563 = SCRLA | 664 = SCR2D | 665 = SCRCC | 166 = SCR2DC | 967 = SCRLW | 168 = SCR2DL | 969 = MPDSP | 26A = VWOFT | 76B = FADE | 96C = FADEW | 16D = IDLCK | 46E = LSTMP | 36F = SCRLP | 670 = battle | 471 = BTLON | 272 = BTLMD | 373 = PGTDR | 474 = GETPC | 475 = PXYZI | 876 = PLUS! | 477 = PLUS2! | 578 = MINUS! | 479 = MINUS2! | 57A = INC! | 37B = INC2! | 37C = DEC! | 37D = DEC2! | 37E = TLKON | 27F = RDMSD | 380 = set byte(<1>)[<1>]=<1> | 481 = SET-WORD | 582 = BIT-ON | 483 = BIT-OFF | 484 = BIT-XOR | 485 = PLUS | 486 = PLUS2 | 587 = MINUS | 488 = MINUS2 | 589 = MUL | 48A = MUL2 | 58B = DIV | 48C = DIV2 | 58D = MOD | 48E = MOD2 | 58F = AND | 490 = AND2 | 591 = OR | 492 = OR2 | 593 = XOR | 494 = XOR2 | 595 = INC | 396 = INC2 | 397 = DEC | 398 = DEC2 | 399 = RANDOM | 39A = LBYTE | 49B = HBYTE | 59C = 2BYTE | 69D = SETX | 79E = GETX | 79F = SEARCHX | 11A0 = PC | 2A1 = CHAR | 2A2 = DFANM | 3A3 = ANIME1 | 3A4 = VISI | 2A5 = XYZI | 11A6 = XYI | 9A7 = XYZ | 9A8 = MOVE | 6A9 = CMOVE | 6AA = MOVA | 2AB = TURA | 4AC = ANIMW | 1AD = FMOVE | 6AE = ANIME2 | 3AF = ANIM!1 | 3B0 = CANIM1 | 5B1 = CANM!1 | 5B2 = MSPED | 4B3 = DIR | 3B4 = TURNGEN | 6B5 = TURN | 6B6 = DIRA | 2B7 = GETDIR | 4B8 = GETAXY | 5B9 = GETAI | 4BA = ANIM!2 | 3BB = CANIM2 | 5BC = CANM!2 | 5BD = ASPED | 4BE =  | 0BF = CC | 2C0 = JUMP | 11C1 = AXYZI | 8C2 = LADER | 15C3 = OFST | 12C4 = OFSTW | 1C5 = TALKR | 3C6 = SLIDR | 3C7 = SOLID | 2C8 = PRTYP | 2C9 = PRTYM | 2CA = PRTYE | 4CB = IF-PRTYQ | 3CC = IF-MEMBQ | 3CD = MMB+- | 3CE = MMBLK | 2CF = MMBUK | 2D0 = LINE | 13D1 = LINON | 2D2 = MPJPO | 2D3 = SLINE | 16D4 = SIN | 10D5 = COS | 10D6 = TLKR2 | 4D7 = SLDR2 | 4D8 = PMJMP | 3D9 = PMJMP2 | 1DA = AKAO2 | 15DB = FCFIX | 2DC = CCANM | 4DD = ANIMB | 1DE = TURNW | 1DF = MPPAL | 11E0 = BGON | 4E1 = BGOFF | 4E2 = BGROL | 3E3 = BGROL2 | 3E4 = BGCLR | 3E5 = STPAL | 5E6 = LDPAL | 5E7 = CPPAL | 5E8 = RTPAL | 7E9 = ADPAL | 10EA = MPPAL2 | 10EB = STPLS | 5EC = LDPLS | 5ED = CPPAL2 | 8EE = RTPAL2 | 8EF = ADPAL2 | 11F0 = MUSIC | 2F1 = Sound | 5F2 = AKAO | 14F3 = MUSVT | 2F4 = MUSVM | 2F5 = MULCK | 2F6 = BMUSC | 2F7 = CHMPH | 4F8 = PMVIE | 2F9 = MOVIE | 1FA = MVIEF | 3FB = MVCAM | 2FC = FMUSC | 2FD = CMUSC | 6FE = CHMST | 3FF = GAMEOVER | 1


Now STARTMAP is the first room in the debug room. Yuffie is there and you have that first menu, here is the code for that room as it's really small.

This is the text section.
Code: [Select]
Code:
000------------------------------------------------        NEXT{EOL}        MENU ON{EOL}        BATTLE LOCK{EOL}        BATTLE UNLOCK{EOL}        MOVIE LOCK{EOL}        MOVIE UNLOCK{EOL}        GLOBAL RESET{EOL}        FULL NAME{EOL}        NEW START{EOL}        EXIT{STOP}001------------------------------------------------        BACK{EOL}        SOUND RESET{EOL}        FULL MATERIA{EOL}        BATTLE999{EOL}        EXIT{STOP}002------------------------------------------------MMMMMMMMMMMMMMM{STOP}003------------------------------------------------WWWWWWWWWWWWWWW{STOP}004------------------------------------------------MMMMMMMMMMMMMMM{STOP}005------------------------------------------------WWWWWWWWWWWWWWW{STOP}006------------------------------------------------MMMMMMMMMMMMMMM{STOP}007------------------------------------------------WWWWWWWWWWWWWWW{STOP}008------------------------------------------------MMMMMMMMMMMMMMM{STOP}009------------------------------------------------WWWWWWWWWWWWWWW{STOP}00A------------------------------------------------MMMMMMMMMMMMMMM{STOP}

and this is the script section

Code: [Select]
Code:
****** Section n°0 (dic) Script n° 0 ******000 : PRTYP ( 00 )002 : RET003 : RET                                                                                ****** Section n°0 (dic) Script n° 1 ******000 : RET                                                                                ****** Section n°1 (cloud) Script n° 0 ******000 : CHAR ( 00 )002 : PC ( 00 )004 : RET005 : XYZI ( 00, 00, 00, 00, 00, 00, 00, 00, 01, 00 )010 : RET                                                                                ****** Section n°1 (cloud) Script n° 1 ******000 : RET                                                                                ****** Section n°2 (tifa) Script n° 0 ******000 : CHAR ( 01 )002 : PC ( 02 )004 : RET005 : RET                                                                                ****** Section n°2 (tifa) Script n° 1 ******000 : RET                                                                                ****** Section n°3 (cid) Script n° 0 ******000 : CHAR ( 02 )002 : PC ( 08 )004 : RET005 : RET                                                                                ****** Section n°3 (cid) Script n° 1 ******000 : RET                                                                                ****** Section n°4 (yufi) Script n° 0 ******000 : CHAR ( 03 )002 : XYZI ( 00, 00, B6, FF, 7E, FF, 00, 00, 64, 00 )00D : DIR ( 00, 60 )010 : SLIDR ( 00, 01 )013 : RET014 : RET                                                                                ****** Section n°4 (yufi) Script n° 1 ******000 : window( id=01, X=0000, Y=0000, W=008A, H=00A9 )00A : ASK ( 05, 01, 00, 00, 09, 00 )011 : gotoNext +15013 : window( id=01, X=0000, Y=0000, W=0081, H=0059 )01D : ASK ( 05, 01, 01, 00, 04, 00 )024 : gotoNextLong +009D027 : if UByteL(50)[00] != 00 then(00) gotoLong +000702E : gotoPrev -1B030 : gotoNextLong +0090033 : if UByteL(50)[00] != 01 then(00) gotoLong +000A03A : SET-WORD ( 20, 1E, 00, 00 )03F : gotoNextLong +0081042 : if UByteL(50)[00] != 02 then(00) gotoLong +0008049 : SPECIAL ( FB )04B : REQ ( 11, 74 )04E : RET04F : if UByteL(50)[00] != 03 then(00) gotoLong +0008056 : SPECIAL ( FB )058 : RET059 : gotoNextLong +006705C : if UByteL(50)[00] != 04 then(00) gotoLong +0008063 : SPECIAL ( FC )065 : REQ ( 11, 5A )068 : RET069 : if UByteL(50)[00] != 05 then(00) gotoLong +0008070 : SPECIAL ( FC )072 : RET073 : gotoNextLong +004D076 : if UByteL(50)[00] != 06 then(00) gotoLong +000707D : SPECIAL ( FE )07F : gotoNextLong +0041082 : if UByteL(50)[00] != 07 then(00) gotoLong +0029089 : SPECIAL ( FD )08B : RET08C : REQSW ( 0F, FD )08F : REQ ( 03, 0F )092 : CMUSC ( 02, 04, 0F, FD, 03 )098 : PRQSW ( 0F, FD )09B : PRQSW ( 06, 0F )09E : CMUSC ( 06, 07, 0F, FD, 08 )0A4 : JOIN ( 0F )0A6 : CMUSC ( 04, 0A, 0F, FD, 07 )0AC : SPLIT ( 11, 13, 00, 15, 50, 00, 08, 00, 0C, 00, 60, 74, 00, 00 )0BB : RET0BC : RET0BD : RET0BE : RET0BF : RET0C0 : RET0C1 : RET0C2 : if UByteL(50)[00] != 00 then(00) gotoLong +00080C9 : gotoPrevLong -00C90CC : gotoNextLong +01020CF : if UByteL(50)[00] != 01 then(00) gotoLong +00DF0D6 : AKAO ( 00, 00, 00, C0, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )0E4 : AKAO ( 00, 00, 00, A0, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )0F2 : AKAO ( 00, 00, 00, A1, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )100 : AKAO ( 00, 00, 00, A2, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )10E : AKAO ( 00, 00, 00, A3, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )11C : AKAO2 ( 00, 00, 00, C8, FF, 7F, 00, 00, 00, 00, 00, 00, 00, 00 )12B : AKAO2 ( 00, 00, 00, E4, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 )13A : AKAO2 ( 00, 00, 00, B0, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 )149 : AKAO2 ( 00, 00, 00, B1, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 )158 : AKAO2 ( 00, 00, 00, B2, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 )167 : AKAO2 ( 00, 00, 00, B3, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 )176 : MUSIC ( 00 )178 : AKAO ( 00, 00, 00, 28, 3F, 00, 00, 00, 00, 00, 00, 00, 00 )186 : AKAO ( 00, 00, 00, 29, 3F, 00, 00, 00, 00, 00, 00, 00, 00 )194 : AKAO ( 00, 00, 00, 2A, 3F, 00, 00, 00, 00, 00, 00, 00, 00 )1A2 : AKAO ( 00, 00, 00, 2B, 3F, 00, 00, 00, 00, 00, 00, 00, 00 )1B0 : gotoNextLong +001E1B3 : if UByteL(50)[00] != 02 then(00) gotoLong +000B1BA : SPECIAL ( F9 )1BC : SPECIAL ( F9 )1BE : SPECIAL ( F9 )1C0 : gotoNextLong +000E1C3 : if UByteL(50)[00] != 03 then(00) gotoLong +00071CA : battle ( 00, E7, 03 )1CE : MHMMX                                                                                ****** Section n°4 (yufi) Script n° 2 ******000 : RET

THANKS LASYAN3!!!!!


Oh, and Gears has been updated.
http://the-afterm.ath.cx/gears/gears.pdf

Oh: One last thing...
Which field file is the first one where the game starts? Not STARTMAP, but where Barret says "C'mon newcomer, follow me"
 
Which field file is the first one where the game starts? Not STARTMAP, but where Barret says "C'mon newcomer, follow me"

That would be MD1STIN.

And looking through those scripting commands, it looks like it won't be too hard to figure out the majority of them. At least quite a few. It seems to function very much like working with something like RPG Maker, only without the 'nice' interface...
 
Hehe, sorry, I guess I'm writing out my accent. ^_^

You know, I wish I would of been the one to find them, then I could of named them whatever I want....
 
Hehe, sorry, I guess I'm writing out my accent. ^_^

You know, I wish I would of been the one to find them, then I could of named them whatever I want....

Halkuns?
 
Don't tempt me ^_^

"If you look at halkun 0x28, it has the name "KOWAI" which is Japanese for 'Scary'. If you notice, it has 255 ARGUMENTS which is quite scary indeed"

Seriously, I overslept last night so I didn't get a chance to take a peek at anything last night. I need help finding what sections of the PC field files conatin the even scripts. I need to know what these arguments do too. They aren't exactly jumping out.
 
well KAWAI in japanese means "cute" and is a word used for the deformed (field-like) manga characters
 
AUGH! I'm so frustrated!

I'm trying to write a program to list/edit/save the script and I remember that I do not have the displine for programming!

I've never programmed file I/O in C before and it's frustrating the pants off me!

For those who want to experiment instead, the script is in the first section of the field file. Just dump that section, find the pointer to the start of the script and start dumping using my tables above. I know it sounds easy, but to me it's a pain.

I'm a writer, not a programmer.

I'm gonna work on gears some more. I'm going to need a code jockey to assist me in defining some of these commands and arguments. I can't do it by myself.
 
here is some quick tutorial on file reading in c
Code: [Select]
Code:
/*  note to fopen(): file modes are defined usually by two character string "rb" means open file for Read in Binary mode.  r=read w=write b=binary t=text so "wt" means open for Write in Text format there are also other possibilites, but they are not used much ... they are mentioned in help :) binary commands in simple are: fread( pointer_to_data_buffer, 1, sizeof_data, file_handle ); fwrite( pointer_to_data_buffer, 1, sizeof_data, file_handle ); fread returns number of bytes read fwrite returns number of bytes written and text commands: fprintf( file_handle, "text text text\n" ); fgets( buffer, buffer_size, file_handle ); fprintf prints formatted text to a file fgets reads text from file until buffer_size bytes are read or end of line is read, which comes first.*/// Example 1// This proggy will read 10 longs (4byte integers) from binary file// and write them in human-readable form into text file#include <stdio.h>  // header for file functionsFILE *fin, *fout;  // file handleslong i, l;// input is in binary modefin = fopen( "somepath\\binary", "rb" );// output will be in text modefout = fopen( "somepath\\text", "wt" );// if fopen() fails then it returns NULL. So if you want to check if file // was opened correctly then compare fin and fout to NULLfor( i=0; i<10; i++ ) {  fread( &l, 1, sizeof( long ), fin );  fprintf( fout, "Integer # %i. = %i\n", (int) i, (int) l );}fclose( fout );fclose( fin );

Code: [Select]
Code:
//one more note// to make things simplier when reading some complex structure, data can be read into structs too.// maybe some byte-alignment pragma will be needed here for your compiler to pack the structure correctly without gaps between variables, if compiler's default variable alignment is 8bytes for example. #pragma pack (1) will do the trick for MSVC++struct {  long    length;  float   coords[ 3 ];} data;fread( &data, 1, sizeof( data ), fin );
 
And for what its worth, you should look at the code I wrote in Alhexx's Rewritting the FF7 Engine thread, as it contains some file I/0 stuff used for C++.

Though, I can give you a little rundown here as well.  Keep in mind that this is for C++ (not regular C), so don't get this and Mirex's stuff mixed up.

Code: [Select]
Code:
#include <fstream>    //needed for fstream file operations//variable declarationfstream variable_name;//syntax for using the fstream file object to open a file//to READ from. This applies to when the file being load-//ed is in the same directory as the program.  If file is to//be opened as ACSII, the "ios::binary" flag is NOT needed.fstream variable_name("filename.txt", ios::in | ios::binary);//syntax for opening a file in read mode that is not in the//same directory as the program.fstream variable_name("insert_ABSOLUTE_path_to_file_here", ios::in | ios::binary);//the same syntax applies for files in which you wish to//open in WRITE mode, except that instead of "ios::in"//you use "ios::out"fstream variable_name("filename.txt", ios::out | ios::binary);//if you plan to APPEND to a file you are writing to,//you should open it using the "ios::app" flag instead of//"ios::out" flag.fstream variable_name("filename.txt", ios::app | ios::binary);//syntax to close a file -- the fstream object's variable//name is not destroyed, but IS freed up for you to//assign to a different file, if I remember correctly.variable_name.close();

Yeah, I realize both this and what Mirex posted is a lot to digest at once, so I'll wait before going into detail about the ".read" and .write" fstream member functions.
 
I appricate the help, but I really have 0 intrest in coding. I'm a *writer* (I know, you can't tell by the way I write my posts, but that's becuase I have it "off" right now.)

I code in a language called "Ruby" which is much more simple. I lothe the idea of doing manual memory management unless it's in machine code. Most file I/O requires you to manage some kind of memory buffer and a pointer an I'm not one to hose my memory just to get something the bearly works. I will contine to write Gears and hope that those more apt than I can use it to thier advantage.

Also remeber, my inbox is always open. If you have problems or dicoveroies yourself, I beg you to give me some input. Right now I'm just stuffing the file format stuff at the end until I can get a better gauge of what goes where. I have many other things on my plat I need to do first. The cool thin is if I get frustrated with something, or can't figure it out, I can move on to another. Maybe pushing the bock around in the right way will cause things to fall into order.

I'm gonna table-fy the scripting commands, and then dump the code for all the debug rooms to see what each character was supposed to test. Some of them have dummied out commands which will prove quite useful as we can see what character was supposed to do. I know that each debug room is split up by deveoper. That's what the Japanese characters mean, it's the first character of the deveoper's last name.

Now that I have how to dump the script posted here (In mutiple topics... Sorry!) I invite some of the more adventouous souls to start flipping bits and see how the dubug room is effected.

I'll have everything sorter out in Gears soon enough and that could be a unified resourse.
 
Hum, you probably know it, but just in case, this document talk about the debug room : here
 
Last edited:
What!?

Memory management? If you are righting something that just reads and dissassembles scripts, you probably do not need to know that much about it. Just have it dump it's output to a file.

Also, you could have it dump it all to the screen and redirect stdout like this:

yourprogram > output.txt

in the command line. If you do not want to overwrite it, just add it to the end, you would do this:

yourprogram >> output.txt

One problem you will have is that there will not be any output to the screen doing this. This works in Linux and Windows, btw. Also, since you use Linux, you can pipe it to less (you can pipe stuff in Windows, but Windows does not have less you have to use more instead):

yourprogram|less

If you have an error and you do not want it to be redirectedto the file, use stderr instead of stdout, like this:

fprintf(stderr,"Error: could not load file %s",filename);
 
Is this used for magic and weapon rules as well, or are those hardcoded into the kernel? And there are those scripted battles, are they using the same system? That would open the way to something like SCUMM for Final Fantasy...
 
Is this used for magic and weapon rules as well, or are those hardcoded into the kernel? And there are those scripted battles, are they using the same system? That would open the way to something like SCUMM for Final Fantasy...
No the engines for each version of FF are different notice FF8 and FF9 for the PSX are all coded using a singular image for the entire data set with a simple engine to read from it.

Each version would need a seperate engine basically FF8 and FF9 are closer than Ff7 and the others.

Cyb
 
Battle is a preprogrammed module. Field can call battle using one commands and three arguments, that's it.

Does battle use the same scripting engine for battle math? I don't think so, but many of these commands are kenrel services. I have yet to map all the data within a magic LZS yet. I'm too buys playing with the event scripter.

The commands available to the field scripter are from the kernel that the field module sits on. I'm still looking at what these commands do. I haven't inserted my own commands into the debug rooms yet. I'm happy with the preset debug configs as they exersize the commands quite well.

When I finish documenting the entire debug system, I'll start tweaking each of the command testers and see what results I get.

Here's an amusing thing:
Some options don't make sense when you use the debug room. That's because the script is doing more "under the hood" than you are lead to believe.

For example, there is a command that gives a really wierd amount of gil. Actully it's not wierd at all. What the command really did was give two different amounts of gil right after another. It was a tester for the GOLD+ command and the result was to make sure the kernel added the amounts right to create a total.

Other times you character is found stuck in a all, that's because the script simply did a JUMPMAP with no location arguments. I'm sure the event programmer was just making sure the map loaded with no errors. It's trivial to change the JUMPMAP data to make the player appear on the walkmesh so you can walk around. Why though. It was understood that the walkmesh worked.

This is sooo cool ^_^
 
There is also a "tester battle" against 5 pyramids that give insane amounts of experiance each battle ( took me up over 40 levels in one go, And mastered 14 peices of materia)) I beleive this, like the gil+ command, Is a testing prog for Exp and AP.
 
Status
Not open for further replies.
Back
Top