Update to 0.31 :
- You can now fully choose which statuses are inflicted (or healed) by spells,
- World Maps have 2 more sub-panels : they allow to modify the name of the different places and modify the random encounters in the different areas. However, you can only use random encounters with the proper battle scene or the game will crash. Also, you can't see where are placed those areas on the World Map yet.
- Improved the script edition a lot :
--- Added a way to declare and use local variables. More details below.
--- Added a list of different known functions and variables, with their descriptions.
--- You now easily generate the value corresponding to different things, such as an attack list for enemy IA, or a button list to get the player's inputs.
--- Added a preview of the field walkmesh when editing a field script. The positions in the code are viewed on this preview.
--- Same thing for the world map. The preview can't be zoomed tough.
--- Improved the argument helpers for several data types, such as positions or colors.
About the local variables, the syntax is this one :
local [type] [name] [Default Name]
// example
local uint8 foo VAR_LocUInt8_10
EDIT: You can now use global variable as well: they are shared by the other entries of the script and are declared using the keyword "global" insteal of "local".
[type] can be one of the following : Bool, SBool (same as Bool), Int8, UInt8, Int16, UInt16, Int24, UInt24 and Null (dummied).
For integers (int) and positive integers (uint), the number is the size in bits, so Int16 is 16 bits (= 2 bytes) long.
[name] is the name you want for your local variable.
[Default Name] is optional and is the name of the variable you want to replace. It should have a compatible size. Note that this default name can still be used to refer to your variable.
If you don't specify it, a default one will be attributed. However, it will likely mess with the local variables already used in the script and not declared.
Usually,
int8 are of the form VAR_LocInt8_##
int16 are of the form VAR_LocInt16_##
uint16 are of the form VAR_LocUInt16_##
etc...
Local variable settings can be saved in .hws files independantly of the rest.
I'm planning to create a .hws file containing all the local variables used by the game by default. Once it'll be done, you can import it and declare local variables without fear of collision with the ones existing (not to mention it will largely increase the readability).
A local variable declaration needs to be parsed to take effect. It can't throw an error but if there's a problem, you'll get a warning and the problematic line will be ignored.
The most immediate and practical use is that you can rename a variable once you understood the purpose :
- Check that the variable is local or global by looking at its name.
- If it's a general variable instead, you may declare it global and still use it as a global variable provided you use the right [Default Name].
- Declare the variable anyway ; the only thing left is to choose its name, which should be feasible since you understood its purpose.
- Parse, close the script window and open it back. The cryptic variable's name has been replaced by the name you've chosen.
Example : for some treasures, the variables "VAR_GenInt16_220" to "VAR_GenInt16_224" serve as settings the treasure's position and item.
If you find a script looking like this :
Function Zidane_12
TimedTurn( Angle(VAR_GenInt16_220, VAR_GenInt16_222), 16 )
WaitTurn( )
if ( VAR_GenUInt8_226 == 0 ) {
if ( VAR_GenInt16_224 == 29999 ) {
WindowSync( 7, 0, 6 )
} else {
if ( VAR_GenInt16_224 >= 1000 ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenInt16_228 = ( VAR_GenInt16_224 - 1000 )
if ( ( VAR_GenInt16_228 + GetGil ) > 9999999L ) {
set VAR_GenInt16_228 = ( 9999999L - GetGil )
}
AddGil( VAR_GenInt16_228 )
SetTextVariable( 0, VAR_GenInt16_228 )
WindowSync( 7, 0, 6 )
set VAR_GenUInt8_226 = 1
} else {
if ( ( GetItemCount(VAR_GenInt16_224) < 99 ) && ( VAR_GenInt16_224 < 512 ) ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenUInt8_226 = 1
SetTextVariable( 0, VAR_GenInt16_224 )
AddItem( VAR_GenInt16_224, 1 )
WindowSync( 7, 0, 4 )
} else {
if ( ( VAR_GenInt16_224 >= 512 ) && ( GetCardAmount < 100 ) ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenUInt8_226 = 1
SetTextVariable( 0, VAR_GenInt16_224 )
AddItem( VAR_GenInt16_224, 1 )
WindowSync( 7, 0, 5 )
} else {
SetTextVariable( 0, VAR_GenInt16_224 )
if ( VAR_GenInt16_224 < 512 ) {
WindowSync( 7, 0, 8 )
} else {
WindowSync( 7, 0, 9 )
}
}
}
}
}
}
return
Then you can declare these :
global int16 TreasurePositionX VAR_GenInt16_220
global int16 TreasurePositionY VAR_GenInt16_222
global int16 TreasureItem VAR_GenInt16_224
global uint8 TreasureTaken VAR_GenInt16_226
Parse, close and reopen and find this instead :
Function Zidane_12
TimedTurn( Angle(TreasurePositionX, TreasurePositionY), 16 )
WaitTurn( )
if ( VAR_GenUInt8_226 == 0 ) {
if ( TreasureItem == 29999 ) {
WindowSync( 7, 0, 6 )
} else {
if ( TreasureItem >= 1000 ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenInt16_228 = ( TreasureItem - 1000 )
if ( ( VAR_GenInt16_228 + GetGil ) > 9999999L ) {
set VAR_GenInt16_228 = ( 9999999L - GetGil )
}
AddGil( VAR_GenInt16_228 )
SetTextVariable( 0, VAR_GenInt16_228 )
WindowSync( 7, 0, 6 )
set VAR_GenUInt8_226 = 1
} else {
if ( ( GetItemCount(TreasureItem) < 99 ) && ( TreasureItem < 512 ) ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenUInt8_226 = 1
SetTextVariable( 0, TreasureItem )
AddItem( TreasureItem, 1 )
WindowSync( 7, 0, 4 )
} else {
if ( ( TreasureItem >= 512 ) && ( GetCardAmount < 100 ) ) {
RunSoundCode3( 53248, 108, 0, -128, 125 )
set VAR_GenUInt8_226 = 1
SetTextVariable( 0, TreasureItem )
AddItem( TreasureItem, 1 )
WindowSync( 7, 0, 5 )
} else {
SetTextVariable( 0, TreasureItem )
if ( TreasureItem < 512 ) {
WindowSync( 7, 0, 8 )
} else {
WindowSync( 7, 0, 9 )
}
}
}
}
}
}
return
I hope you enjoy the changes
![Wink ;)](https://forums.qhimm.com/Smileys/akyhne/wink.gif)