Author Topic: Can someone explain how to do blocking actions?  (Read 274 times)

0 Members and 1 Guest are viewing this topic.

Offline Scavenger

Can someone explain how to do blocking actions?
« on: February 11, 2017, 07:45:03 PM »
I've been messing around for the past day or so with SCI 1.1, and so far I really like it - it's way better than SCI0 for what I do, which is mostly VGA stuff.  I've been working through the tutorials and the help file getting used to the engine, but there's still something I've not got my head around, and that's stopping the game while an action takes place, say, if you have an example scene:

Man: "You should try the wine. It is on the table over there."
Ego: "I think I shall."
(Ego walks to table, picking up animation plays.)
(Wait a second or two)
Man: "To your health, good sir."
(Ego drinking animation.)
Ego: "Egad, this is poisoned!"

I know that in AGS, you could queue up Character.Say commands and animations like so:

Code: [Select]
cMan.Say ("You should try the wine. It is on the table over there.");
cEgo.Say ("I think I shall.");
cEgo.Walk (200,150,eBlock);
cEgo.LockView (EGO_TAKE);
cEgo.Animate (0,5,eBlock);
cEgo.UnlockView ();
Wait (80);
cMan.Say ("To your health, good sir.");
...etc...

But I'm not sure what the equivilent would be in SCI Script... I've managed to do a Script before (while running through the tutorial to make the ship move), so I'm certain it's something to do with those, but how I'd set it up so that the player can't interact while this is going on except to skip speech is beyond me. Any pointers to where I should look? Thanks in advance!



Online Kawa

Re: Can someone explain how to do blocking actions?
« Reply #1 on: February 11, 2017, 08:51:47 PM »
You set HandsOff at the start, and HandsOn at the end.

I'm in bed right now, posting from my phone, so I can't/won't look up the details.

Offline troflip

Re: Can someone explain how to do blocking actions?
« Reply #2 on: February 11, 2017, 09:03:58 PM »
^^^ close enough for posting from bed.

(gGame handsOff:)


(gGame handsOn:)


You can see it used a bunch in SCI Quest.

Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Scavenger

Re: Can someone explain how to do blocking actions?
« Reply #3 on: February 11, 2017, 09:10:05 PM »
Thanks! I'll try it out and see if I can't make something happen!

Online Kawa

Re: Can someone explain how to do blocking actions?
« Reply #4 on: February 12, 2017, 04:11:01 AM »
Or rather, make something not happen.

Offline Scavenger

Re: Can someone explain how to do blocking actions?
« Reply #5 on: February 12, 2017, 05:01:44 AM »
Okay, I think I've worked it out, I did a really simple interaction to make the ego walk to a place and back again:

Code: [Select]
(instance guytalkScript of Script
(properties)

(method (changeState newState)
(= state newState)
(switch state
(0
(gGame handsOff:)
(gEgo setMotion: MoveTo 282 91 guytalkScript)
)
(1
(gEgo setMotion: MoveTo 174 174 guytalkScript)
)
(2
(gGame handsOn:)
)
)
)
)

And it seems to work! The game stops, the ego walks, the game waits til he gets there and he walks back again. This is how you're supposed to use the changestate method, right? I'm not doing this entirely wrong?

Online Kawa

Re: Can someone explain how to do blocking actions?
« Reply #6 on: February 12, 2017, 01:10:12 PM »
That's about it yeah.

Offline troflip

Re: Can someone explain how to do blocking actions?
« Reply #7 on: February 12, 2017, 01:18:20 PM »
Two style choices I usually make:
    - When passing the "who cares" parameter to the setMotion (or setCycle or whatever) calls, I usually use self instead of the hardcoded name of the script to cue. That way if I move the code to another Script, I don't need to remember to change anything (i.e. the code becomes more portable).
    - I usually use switchto instead of switch for changeStates, that way I can easily add/remove states and not have to adjust the numbers. I still use switch if I need to refer to a specific state externally (i.e. check if guyTalkScript is in its 3rd state) - in this case I'll use an enum to give the switch states names.

Code: [Select]
(instance guytalkScript of Script
(properties)

(method (changeState newState)
(= state newState)
(switchto state
(
(gGame handsOff:)
(gEgo setMotion: MoveTo 282 91 self)
)
(
(gEgo setMotion: MoveTo 174 174 self)
)
(
(gGame handsOn:)
)
)
)
)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Can someone explain how to do blocking actions?
« Reply #8 on: February 12, 2017, 06:39:28 PM »
I had no idea about switchto! That was SO annoying to deal with numbers with the standard switch!
Brass Lantern Prop Competition


SMF 2.0.11 | SMF © 2015, Simple Machines
Simple Audio Video Embedder

Page created in 0.108 seconds with 21 queries.