Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

farmersckn

how would you implement a script?

This topic is 6927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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...

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!