Jump to content

  • Log In with Google      Sign In   
  • Create Account

how would you implement a script?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 farmersckn   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 1999 - 03:33 PM

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?


Sponsor:

#2 Splat   Members   -  Reputation: 122

Like
Likes
Like

Posted 25 November 1999 - 02:38 PM

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


#3 farmersckn   Members   -  Reputation: 122

Like
Likes
Like

Posted 26 November 1999 - 03:33 PM

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...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS