Conditionals, else feature?

Started by Cluey, Tue 16/10/2007 21:19:43

Previous topic - Next topic

Cluey

Forgive me for the n00b question but here's the scenario:

There's a broken lift in my game, the character has to fix it. First he obtains some tools from a mechanic who's too lazy to do it himself, then he has to find a manual on how to fix it.

So if the player uses the tools on the lift without the manual he says "I don't know what I'm doing!" and when he has the manual he fixes the lift.

So I set up my interaction like this:
Use Inventory on Object
  - Conditional - If inventory item was used (1)               <--- Tools
    Game - Display a message (4)                               <--- "I dunno what I'm doing"
    - Conditional - If the player has an inventory item (2)    <--- If player has manual
      Game - Display a message (5)                              /
      Game - Display a message (6)                             <--- "fixing", blah blah
      Game - Display a message (7)                              \
      Object - Remove an object from the room (0)              /___ Changing the broken lift to a working lift sprite
      Object - Switch an object back on (1)                    \    (Dunno know how to do it the view method)

Interacton Editor screenshot

However, even when I have the manual, he still says "I don't know what I'm doing" before then going on to fix it. Isn't there some sort of "else" clause for the conditionals?

Like if I have the book and use the tools he fixes it, if not he just says "I dunno lol".

I'm new to this (even though I've been on this site for ages I've never really made an advanced game).


edit by scorpiorus: moved from the Technical forum
EDIT by Ashen: Image replaced with text, for easier searching.
Aramore
My webcomic.

Babar

#1
I think this is the wrong place for these type of questions. However, if you really want to use the interaction editor, have your "If player has inventory item (2)" conditional first, and have the last command in the conditional being "Stop running commands" (or something like that). AFTER the conditional, set the Display message for if he doesn't have the manual.
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

Khris

Wrong forum ;)

AGS will process the actions from top to bottom. Since the Conditional that checks whether the player has the manual is after the "I dunno" message, the latter will always be displayed.
There's no else action, but something like "Game - stop running more commands" or whatever it's called, you'll find it.
Use it like this:
Conditional - player has manual
'-- fixing blah blah
'-- Game - stop
Display "I dunno"

Or ditch the whole IE business and use a script:
Code: ags
// use inv item on object 0 (lift)

  if (player.ActiveInventory==inventory[1]) {     // or iTools instead
    if (player.InventoryQuantity[iManual.ID]==0) {
      player.Say("I dunno what I'm doing.");
    }
    else {
      player.Say("Fixing...");
      object[0].Visible=false;
      object[1].Visible=true;
    }
  }
  else player.Say("I need tools to fix that.");    // player used sth. else on the lift


Instead of using two objects, you can use a variable.
To change the sprite of the lift object, change object[0].Graphic.

Cluey

It would be the wrong forum, and asking for Interactions Editor help in a forum for scripting help and tech support was just asking for people to come in with their scary scripts and big words.

Thanks anyway, ye can lock/move/delete it now.
Aramore
My webcomic.

Ashen

Quote
Thanks anyway, ye can lock/move/delete it now.

Has it been answered, then?
Asking for help will always draw people who want to give you the easiest answer they know of. If your idea of easiest involves the Interaction Editor, then the Tech Forum is obviously going to be the wrong place. The number of people who'll post scripting-based answers in the Beginners Tech forum, should also tell you a little about the Interaction Editor (i.e. "It's easier to use script, if you actually want to make a decent game").

However, if you post an IE based question, and ask for an IE based answer, there's no reason to lock or delete a thread until it's answered. (This was written after the thread had been moved to BTQ, so 'move' is obsolete).

If you now know how to arrange your conditions to do what you want, edit the thread title to include '(SOLVED)'. If you don't, and/or would like to know how to code the response you're after, post again.
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk