how would you implement a script?

Started by
1 comment, last by farmersckn 24 years, 4 months ago
Unless you wanted to implement an advanced script language of your own with a compiler, parser, etc., then yes, you will want to just read it in line by line and read its first word (being the command), use that to locate in an array a function pointer, then call that function with the remainder of that line (parameters).

- Splat

Advertisement
would you have a file w/ the script info that could be loaded by your game...
like this:
mov, t, 23, u, l, r, d
could mean to move a tile(23) up, left, right and down.
would you have a function to read the script and then a switch to act upon it?
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.
gee wiz thanks! I'd never thought of using an array of pointers to functions...(i only started learning c++ in sept...) i was actually thinking of doing a huge switch to call the functions...probably very foolish...but i'm a qbasic native...oh well...
thank you...
Yesterday is the past, tomorrow is the future. Today is a gift, that is why we call it the present.

This topic is closed to new replies.

Advertisement