øAslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&topic=272.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index1a81.htmlslickproductions.org/forum/index.php?PHPSESSID=so1iojs5ocdn0o2vf0tti7fbu6&board=16.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index1a81.html.zx„õg^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ ­?ÎOKtext/htmlISO-8859-1gzip8:Ö?ÎÿÿÿÿÿÿÿÿTue, 10 Mar 2020 20:32:27 GMT0ó°° ®0®P®€§²ð®ƒõg^ÿÿÿÿÿÿÿÿ8&?Î Original Fantasy Script Commands

Author Topic: Original Fantasy Script Commands  (Read 5037 times)

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Original Fantasy Script Commands
« on: February 06, 2008, 10:47:29 PM »
This is a place for me to figure out what scripting commands I will need, and to find out from others which commands would be useful to them.  I hate parsing, so I'm going to use a tree-based editor where you basically select commands from a list and fill in the parameters, with the tree branching for if statements and expressions and the like.

There are a few types of script entries: actions, conditions, and assignments.  Actions are simple things like "teleport to Corneria 35, 67" or "switch music to sadness theme."  Conditions evaluate to true or false, and conditional expressions can combine multiple conditions using AND and OR logic operators.  These may also include numeric expressions like "4 - Global.OrbsRestored" to determine how many orbs are remaining.  Assignments assign values to variables, and can also include numeric expressions, such as "Global.OrbsRestored = Global.OrbsRestored + 1".

Regarding variables, each map will have its own namespace for organization, and the quest as a whole will have a global namespace.  All variables from all maps in the quest will be loaded at runtime, so you can refer to variables in other namespaces using the syntax in the above example (Namespace.VariableName).  Events will also have their own names and can be referred to in the same way.


High priority:
Numerical expression evaluation including +, -, *, /, %
Conditional expression evaluation including AND, OR, XOR, NOT, variable equalities and inequalities (=, !=, >, <, etc.)
Condition operator: Has Item
Assignment to variables

Control Flow:
Calling other scripts
If/Else branching
While loop
End of control block (to end an if-else-predicate or while loop)
Break, Continue (loop control)
Return from script

Action: Give/Take Items/Gold
Action: Teleport to Map, Location(x, y)
Action: Conversation(text)
Action: Enable/Disable Event
Action: Ship/Airship Appears at Map, Location(x, y)
Action: Add sprite at Location(x, y)
Action: Move sprite N/S/E/W
Action: Remove sprite
Action: Wait x seconds
Action: Fight Battle (domain d, battle b)
Action: Change map tile (x, y) to (tile data)

Lower priority:
Action: Start/Stop Music
Action: Play sound effect
Action: Perform graphics effects (mosaic, blur, whatever)




I'll keep updating this list as I think of stuff.  Give me your suggestions and feedback please.  :)
« Last Edit: February 24, 2008, 12:00:54 PM by Entroper »

Pinkpuff

  • Flan Princess
  • *
  • Posts: 924
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Original Fantasy Script Commands
« Reply #1 on: February 07, 2008, 09:29:38 PM »
Couldn't variable assignment be a type of action?

Also, no iterative commands? What if you wanted to, say, list everyone's equipment. Would you have to go

* Display character 1's armor 1
* Display character 1's armor 2
* Display character 1's armor 3
* Display character 1's armor 4
* Display character 2's armor 1
...
* Display character 1's weapon 1
...
etc

Or would you have a for-next type command that allows you to go

* For each character
** For each equipment slot
***Display that character's item in that slot
Let's dance!

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #2 on: February 07, 2008, 09:55:52 PM »
These are really for map scripts, I don't think you'll need to do much iteration.  For loops either require local variables (for a counter) or some kind of list structure, which gets pretty complicated.  While-loops are probably doable without too much fuss, since they just require a condition and a return point.

Scripts will be able to call other scripts like functions, or to jump to other scripts (without returning to the current script).  Especially useful if you want to teleport to another map in the middle of a cutscene.

I added a few sprite commands above.

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #3 on: February 15, 2008, 01:35:22 AM »
New action: Change map tile (x, y) to (tile data)

Useful when, for example, creating the bridge from Corneria, or blowing open the canal with the TNT.  Changes a tile's appearance and all its associated data.  You can change the movement flags, the fight flags, even the monster domains.

It's now possible to have treasure chests (I'll probably have a "treasure chest wizard" or something in the editor so you don't have to use the script editor for every chest).  The script looks something like:

IceCave.TreasureFloater
Activate on action button facing (x, y location of chest)
Fight Battle (domain d, battle b (a lone EYE))
Change map tile (x, y location of chest) to (open chest)
Conversation("You found the FLOATER!")
Play Sound (tada.wav)
Give Item (FLOATER)
Deactivate Event (IceCave.TreasureFloater)

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #4 on: February 24, 2008, 06:52:39 PM »
http://entroper.no-ip.org/OF/Scripts.txt

Preliminary script specification.  Will expand as new commands are added.  This gives me something to work with so I can rip the maps out of the ROM and write the map engine.

JCE3000GT

  • Master of FF4
  • *
  • Posts: 1,429
  • Gender: Male
  • Vladof
    • View Profile
    • BlitzKrieg Innovations
Re: Original Fantasy Script Commands
« Reply #5 on: February 24, 2008, 07:42:04 PM »
Explination following.  Don't know if these are or aren't on the list

1. Flash screen xx times using yy palette for zz length per flash
2. Fade in-out at xx speed type yy
3. Mosiac in/out at xx speed
4. Show desert wind when char hits xx coordinates (for use in the mirage desert)
5. Play music xx
6. Fade in/out music xx at yy speed
7. Play sound effect xx for yy number of times
8. Show dialogue entry xx at yy position on screen
9. "ungroup" party on the overworld by type xx

==================================

Explination:

1. Should be self explainatory.  Flash the screen a certain number of times [xx] using palette [yy] at speed [zz] per flash.
2. By "type" I'm referring to the actual fade out animation, circle, square, triangle, random, rotating, you know those sorts of things.
3. When you run into a battle in FF4-6, that effect.
4. Self explanatory.
5. Duh.
6. Duh.
7. Err?
8. Self explainatory.
9. Simply show the party members walk out and form a certain type of formation, 1x3, 2x2, 3x1, 4x0, etc.  Think later FF's when the walking sprite hits an event and everyone comes out of the single sprite to face the event in question.  A picture can be arranged if needed.

How's that?

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #6 on: February 25, 2008, 07:10:44 AM »
Here's the thing, palettized graphics are inefficient on modern graphics hardware.  I'm probably going to experiment with various postprocessing effects and see if I can achieve similar results by applying various transforms to each color component.

I think I can do the mosaic by creating mipmaps of the entire screen and cycling them with point sampling.

Music fading, I should have thought of that.  Thanks.  :)

I'm going to have to figure out the dialog stuff.  I left a lot of space in the opcodes for extra text box commands.

I like the party ungroup suggestion, then I can also have a "move party member" command.  That's a lot easier than trying to use the sprite commands to achieve the same effect.

Imzogelmo

  • Ogopogo Aficianado
  • *
  • Posts: 241
  • Gender: Male
  • Ask me about my other job.
    • View Profile
    • NEPROMR
Re: Original Fantasy Script Commands
« Reply #7 on: February 25, 2008, 03:08:58 PM »
When calling a battle from a script, it may be a good idea to have some bits to use for return values. For instance, you should have some way to check for "died this battle" (you may not necessarily want a game over from a scripted battle). Or you may want to have an event that triggers conditionally from a battle somehow, so some general purpose bits to pass out of the battle can be useful (FF6 has several of these, like "can shadow leave during battle"; basically several flags that effect battle from outside, or outside from inside the battle).

For some command ideas:
Fade-in/out: getting away from FF1 a little bit, you could have some different types of fade-in and out supported. You could have the sides close in (opening for fade in), or top and bottom close in, or a circle that closes in/opens up (a la Zelda III), or an overall fade to/from black (or white) at some specified speed.  So I think those should have at least 2 commands and 2 parameters: Style and speed. Just a thought.  :tongue:
« Last Edit: February 25, 2008, 03:19:30 PM by Imzogelmo »
5/31/16 - I have an assembly of the battle portion of C2, relocated to the F0 bank, which has both vanilla and patch code in my dropbox. I'll be updating it with additional patches as I have time. I will *not* be releasing it publicly, but ask me for the link and I'll share.

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #8 on: February 25, 2008, 07:44:44 PM »
That's a good idea regarding battles.  I think battle formations will eventually have a flag for "if you lose this battle, you don't lose the game" (I think in-battle event scripts probably won't make it into the first version), and of course the scripting system will have to have some way of reading the outcome.

I do plan on having lots of transitions, fades, wipes, mosaics, window blinds, etc.

Entroper

  • Moderator
  • *
  • Posts: 235
  • Gender: Male
    • View Profile
Re: Original Fantasy Script Commands
« Reply #9 on: March 02, 2008, 10:57:17 PM »
Holy crap, it just hit me how to do palette cycling.  It only works for 256-color textures, though, and it involves a dependent texture read, which isn't very fast.  But it should be fast enough on any hardware from the last 3 years.  I'll have to decide if this is worth doing or if I should just stick to post-processing.