You must sign in to post. | Scripting Theory :: May 11, 2007 @ 8:40am |
|---|
eckels
Joined: Mar 4, 2007 Posts: 200 | I would like some general programming help.
This is my plan - I intend to write scripted strayegy tutorials for Galcon, utilizing the level editor that phil has provided, and my beginnermode mod.
My plan is to display written messages (and possibly spoken word) intermittently with computer controlled play - it would be scripted - And I'm wondering what's the easiest way to control it? I was considering starting a timer, and then just triggering certain events at certain times, and pausing the timer when the text, or speech events occur.
Before I spend days working out this system, can someone at least tell me if this is a good method to use? or is there a better option that would be more fool-proof, that I'm not considering due to my inexperience?
If you can lead me down the right path, I'd really appreciate it. | | Re: Scripting Theory :: May 11, 2007 @ 9:03am |
|---|
thirdparty

Joined: Dec 20, 2006 Posts: 279 Location: Eastern U.S.A. | I think it would probably be better to give the next instruction after you detect that the previous one has been folloewd.
(For example, when the game starts, tell the player to attack a planet. The first time the player owns more than one planet, give the next instruction. Etc.) | | Re: Scripting Theory :: May 11, 2007 @ 9:20am |
|---|
eckels
Joined: Mar 4, 2007 Posts: 200 | I think it would probably be better to give the next instruction after you detect that the previous one has been folloewd.
(For example, when the game starts, tell the player to attack a planet. The first time the player owns more than one planet, give the next instruction. Etc.) '
Well, these are strategy tutorials, and they're going to be far more complex than "attack this planet"... there will also be several scenario tutorials... like what to do in a standoff, how to gobble planets up quickly, how to win at 1v1 online, etc... there will be a lot of moves done by the computer, as if it were the player as well. sort of like a scripted demo. dig? | | Re: Scripting Theory :: May 11, 2007 @ 9:21am |
|---|
philhassey

Joined: Nov 30, 2006 Posts: 765 Location: Zarcon | I suggest two things:
1. Store your script as an array of "events to happen":
SCRIPT = [
(event_condition, event_action),
(event_condition, event_action),
(event_condition, event_action),
]
2. In loop():
for event_condition,event_action in SCRIPT:
if event_condition:
return event_action()
(Basically that's what thirdparty said, but this fills it out a bit more detailed like. You might also want to mark an event as completed so you don't do it again or something.)
The key in loop() is that the event_action can return a value which would send you to another state - pausing the "level" while you display some tips, whiteboard the screen, or whatever. That state can return to the "level" state once it's done giving information.
- Phil | | Re: Scripting Theory :: May 11, 2007 @ 9:24am |
|---|
philhassey

Joined: Nov 30, 2006 Posts: 765 Location: Zarcon | If you're going to be doing stuff that's detailed, you'll probably want to write a game recorder - which would be pretty easy (just save all moves that come into fleet() and redirect()) ...
I'll look into adding file_append() function into next version to make that easier.
- Phil | | Re: Scripting Theory :: May 11, 2007 @ 9:26am |
|---|
eckels
Joined: Mar 4, 2007 Posts: 200 | I suggest two things:
1. Store your script as an array of "events to happen":
SCRIPT = [
(event_condition, event_action),
(event_condition, event_action),
(event_condition, event_action),
]
2. In loop():
for event_condition,event_action in SCRIPT:
if event_condition:
return event_action()
(Basically that's what thirdparty said, but this fills it out a bit more detailed like. You might also want to mark an event as completed so you don't do it again or something.)
The key in loop() is that the event_action can return a value which would send you to another state - pausing the "level" while you display some tips, whiteboard the screen, or whatever. That state can return to the "level" state once it's done giving information.
- Phil
That's really smart, phil...
I could use this either way then. Have the event conditions be specific on-screen game conditions (such as a certain planet having the player's p.user.n value), or I could have them be timed events... in the loop i could put a counter, and then just put the counter values (times) as the event_condition right? |
You must sign in to post.
|