Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Bandersnatch

#1
Never mind - there was a brace in the wrong place. Oops!
#2
Hi, I've converted a Hotspot to an object in one of my rooms but for some reason only one of the functions will work with AnyClick...I can look at it and the character will respond as per the scripting but if I try any of the other actions nothing happens at all. Any ideas why this might be? It works with the exact same scripting I have for a different object in the room.

Here's the code for the object:

Code: ags

function oCoffeePot_AnyClick()
{
  if (MovePlayer(239, 82)) {
    player.FaceDirection(eDir_Right);
}
// LOOK AT
    if(UsedAction(eGA_LookAt)) {
      QueuedSpeech.SkipCurrentMessage();
      cEleanor.Say("The coffee isn't ready yet.");
  if(tutorialState==1){
    cWhitfield.SayQueued("Good!");
    cWhitfield.SayQueued("Now go open the door on the left!");
    tutorialState = 2;
    SetTimer(1, 0);
    SetTimer(1, 400); //10 SECONDS
    }
    // USE
    else if(UsedAction(eGA_Use)) {
      player.Say("It isn't ready.");
    }
    // Push
    else if(UsedAction(eGA_Push)) {
      player.Say("Great idea. Burn my hands AND spill the coffee.");
    }
    // Pull
    else if(UsedAction(eGA_Pull)) {
    player.Say("Nah.");
    }  
    // PICKUP
    else if(UsedAction(eGA_PickUp)) {
      player.Say("Not until it's ready.");
    }
    // OPEN
    else if(UsedAction(eGA_Open)) {
      player.Say("It doesn't need opening.");
    }
    // CLOSE
    else if(UsedAction(eGA_Close)) {
    player.Say("It's already closed.");
    }
    //USE INV
    else if(UsedAction(eGA_UseInv)) {
      Unhandled();
    }
    // don't forget this
    else Unhandled();
  }
#3
I think I've cracked it. Before telling the timer to count down from 10 in each change of state, I used setTimer(1, 0), which seems to have reset it. Does that seem logical?
#4
Thanks - I think you're right about using Timer #1 for each state, and that's what I've been doing - the dialogue is changing accordingly but the only thing I can't work out is how to get the timer to reset each time the tutorial state changes. For example, I have the timer set at 400 (about 10 seconds?) but if the tutorial state changes 5 seconds into the countdown, then it's only 5 seconds until the next dialogue. If there's a way to stop/start it again at each state change that would be helpful...
#5
Sorry to bump this after months and months but I'm struggling to change the timers. Obviously Timer(1) is set to repeatedly execute but that's only for when tutorial.State = 1. Once it reaches tutorial.State 2 I want Timer(2) to start and repeatedly execute and so on with each tutorial.State. I'm just not sure where to add the changes in timer.
#6
Okay so I'm not entirely sure what happened - something wen horribly wrong with one of my scripts and then when I reimported the room everything was working. Not sure how that worked.
Now I hate to say it but I'm going to have to bump a really old thread of mine which I couldn't quite get to the bottom of...
#7
Hi,

I recently started using AGS on an iMac running Parallels rather than using my old PC. In doing so I tried to copy the old files for one of my tech demos over to work on it but it wouldn't work properly. I had to rebuild everything from the ground up by exporting/importing all my characters, sprites etc. and that seems to have worked okay.
However as dialogues can't be exported, I just retyped them all...

Now when I try to tell my character to talk to an NPC nothing happens! The dialogues all have the same names and (seemingly) the same properties so I'm not sure why this is happening. I even edited the Global Script again and re-entered the dialogues to see if that would work but to no avail.

Is there something I'm missing here?
#8
So I got to work on doing all that stuff and it works perfectly. Thank you! Now to get my head down and finish this demo ting...
#9
Thanks! So let me get this straight - if I set "tutorialState" as a global variable, I can still use it in the room script but it'll be possible to use it in dialogues too? Excellent. I'll look into it and get back to you, most likely with more rookie questions.
#10
This is the dialogue and scripting after which I'd like the tutorialState to become "5", in which there are no timers or pieces of dialogue. I have no idea how to activate a tutorial state after dialogue.

Code: ags

@5
cEleanor: That's not what I--
cMancomb: I AM DESCENDED FROM A CARIBBEAN GOVERNOR, YOU KNOW!
cMancomb: GET OUT OF MY SIGHT!
  cEleanor.FaceDirection(eDir_Down);
cEleanor: *sigh*
  Wait(40);
cEleanor: What a butt.
  Wait(40);
cWhitfield: Well? How's he doing?
  cEleanor.Walk(287,95,eBlock,eWalkableAreas);
  cEleanor.FaceDirection(eDir_Right);
cEleanor: He's far from satisfied.
  Wait(40);
cWhitfield: That'll be your fault then.
  Wait(40);
cWhitfield: You're fired.
  gAction.Visible = true;
  gMaingui.Visible = true;
stop
#11
This is the script for the room so far, with the tutorial I've put together. Let's not worry about the whole 'reusing Timer 1' thing as I'm working on that. Where we have "tutorialState" as 5, I want this to be activated when a dialogue has happened but I have no idea how to make that work. Obviously there's bits of coding from dialogues and things as well, and I'll upload these in a sec.

Code: ags

//MANCOMB DISMISS BOOL

import function mancomb_dismiss;

function room_FirstLoad()
{
hDoorway.Enabled = false;
}
//TUTORIAL CODING
int tutorialState = 0;
function room_AfterFadeIn(){
  if(tutorialState == 0){ //BEGINNING OF TUTORIAL
  Wait(40);
  cWhitfield.Say("Welcome to the tutorial, shit potatoes!");
  Wait(40);
  cWhitfield.Say("Now go look at the coffee pot!");
  tutorialState = 1;
  SetTimer(1, 400); //10 SECOND TIMER
  set_door_state(0, 0);
  if(mancomb_dismiss==1){
  tutorialState = 5;
  }
  }
}

function room_RepExec(){
  if(IsTimerExpired(1)){
    if(tutorialState==0){
    Display("Reminder");}
    else if(tutorialState==1){
    cWhitfield.SayQueued("Are you even listening?");
    cWhitfield.SayQueued("Look at the coffee pot!");
    SetTimer(1, 400);
    }
    else if(tutorialState==2){
    cWhitfield.SayQueued("I said open the goddamned door!");
    SetTimer(1, 400);
    }
    else if(tutorialState==3){
    cWhitfield.SayQueued("Close the door, there's nothing there!");
    SetTimer(1, 400);
    }
    else if(tutorialState==4){
    cWhitfield.SayQueued("Talk to the customer or you're fired!");
    SetTimer(1, 400);
    }
    else if(tutorialState==5){
    }
  }
}

//END OF TUTORIAL CODING

function hPortrait_Look()
{
  cEleanor.FaceDirection(eDir_Up);
  cEleanor.Say("I wonder if he's got a painting of himself above his bed as well.");
}

function hCoffeePot_Look()
{
  QueuedSpeech.SkipCurrentMessage();
  cEleanor.Say("The coffee isn't ready yet.");
  if(tutorialState==1){
    cWhitfield.SayQueued("Good!");
    cWhitfield.SayQueued("Now go open the door on the left!");
    tutorialState = 2;
    SetTimer(1, 400); //10 SECONDS
    }
}
function oDoor_AnyClick()
{
  if (MovePlayer(53, 88)) {
  }
    // LOOK AT
    if(UsedAction(eGA_LookAt)) {
      player.Say("That door is so poorly fitted.");
    }
    // USE
    else if(UsedAction(eGA_Use)) {
      player.Say("Please be more specific, Sir Graham.");
    }
    // Push
    else if(UsedAction(eGA_Push)) {
      player.Say("It might break.");
    }
    // Pull
    else if(UsedAction(eGA_Pull)) {
    player.Say("Nah.");
    }  
    // PICKUP
    else if(UsedAction(eGA_PickUp)) {
      player.Say("Pick up a door?!");
    }
    // OPEN
    else if(UsedAction(eGA_Open)) {
      if (get_door_state(0)==1)
      player.Say("It's already open.");
      if (get_door_state(0)==0)
      player.Say("Maybe if it had a second sprite...");
      oDoor.Graphic=244;
      oDoor.X=40;
      oDoor.Y=85;
      hDoorway.Enabled = true;
      set_door_state(0, 1);
      Wait(40);
      cWhitfield.SayQueued("Bah! The useless developer of this stupid game hasn't even drawn the next room!");
      cWhitfield.SayQueued("So what are you waiting for?! Close it again!");
      tutorialState = 3;
      SetTimer(1, 400);

    }
    // CLOSE
    else if(UsedAction(eGA_Close)) {
      if (get_door_state(0)==0)
      player.Say("It's already closed.");
      if (get_door_state(0)==1)
      oDoor.Graphic=245;
      oDoor.X=12;
      oDoor.Y=87;
      hDoorway.Enabled = false;
      set_door_state(0, 0);
      cWhitfield.SayQueued("You may have noticed there's a customer back here.");
      cWhitfield.SayQueued("Don't you think it's a tad rude not checking up on him?!");
      tutorialState = 4;
      SetTimer(1, 400);
    }
    //USE INV
    else if(UsedAction(eGA_UseInv)) {
      Unhandled();
    }
    // don't forget this
    else Unhandled();
  }

#12
Thanks Khris, I may well be making that mistake. I'll have a play around with use of timers and the aforementioned booleans for a few functions which could probably be simplified using them.

Another quick question...

After a particular dialogue tree, there is a scripted exchange in which the player character walks to a different spot for some brief dialogue. As soon as I regain control however, she walks back to the spot she was in during the original dialogue tree. How do I stop that happening?

I have an enquiry or two about putting my tutorial coding in the global script rather than the room script and then importing it as it's causing some issues with executing commands at the right time. However, use of booleans might help. I can picture it in my head so I'll give that a shot first.
#13
I have recently come back to a tech demo I left alone a while back, and seem to have hit a snag concerning the SetTimer function. Each part of the timed tutorial has a character repeat a couple of lines in the background with a 10 second interval between repeating phrases. Once the tutorial reaches a certain point however, the character repeats the same line over and over without any 10 second interval despite it being written in the EXACT same way it has been previously. Any ideas?
#14
I've never used a boolean (spelling?) before so I'm not entirely sure how they work. Seriously, I have such good intentions but my tiny brain struggles with even the most basic of coding. How would a piece of script look using a bool command for a door?
#15
Never mind, found a way. I think.
#16
Hi all,

I know this will sound really amateur, but how do I make my game determine whether a door is open or closed and change the player character's actions accordingly?

The closed door is set as an object with a hotspot behind it for the open doorway (initially disabled). I can have my character open the door, but when I want her to close it, she still says "It's already closed". I have no idea what conditions/parameters/variables/states to change in order to make the door work properly...:undecided:
#17
Hey, right now it's simply to get a character speaking in the background with animation so I can keep control during the opening tutorial - so your module is perfect. Got it working this morning and it works great.
Though in future I may need to use the other for its particular uses so it'll be worth importing both modules. Keep up the good work!
#18
looooool yeah as soon as I'd posted that I thought "let's try this really obvious potential solution" and lo and behold! It worked. I really should stop panicking and asking so many questions so quickly...
#19
Okay so another question, how can I make the NPC repeat the reminders until I fulfill the objective? After they've said the reminder once, nothing happens.

Also I've had to use room_RepExec() rather than repeatedly_execute. will that be a problem?
#20
Sorry to drag this topic up after such a long time but I'm finding a problem - the text display is off the right of the screen! Any ideas about that?
SMF spam blocked by CleanTalk