Autor Thema: Problem AnyClickonHotspot bei AGS 3.1.2.  (Gelesen 4787 mal)

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Problem AnyClickonHotspot bei AGS 3.1.2.
« am: 24. Oktober 2010, 21:59:58 »
Hallo Leutz!

Habe ein Problem mit den Türen, wovon die eine Tür sich links vom Raum befindet und die andere Tür rechts. Und zwar mit der Tür links läuft es einwandfrei, wie es laufen sollte. Nur bei der Tür rechts führt er das Hotspot-Script nicht aus, sondern nur ein Unhandled und ich weiss mir keine Erklärung dafür.

Das Script sieht folgendermaßen aus:

function hDoorLeft11_AnyClick()
{

if (Action == aWalkTo) {
 
}

else if (Action == aOpen) {
  if (GetGlobalInt(111) == 0) {
    DoorLeft11.Visible = true ;
    PlaySound(2);
    SetGlobalInt(111, 1) ;
  }
  else player.Talk("This door is already open."); 
}

else if (Action == aClose) {
  if (GetGlobalInt(111) == 1) {
    DoorLeft11.Visible = false ;
    PlaySound(3);
    SetGlobalInt(111, 0);
  }
  else player.Talk("This door is already closed.");
}

}


function hDoorRight11_AnyClick()
{

if (Action == aWalkTo) {
 
}

else if (Action == aOpen) {
  if (GetGlobalInt(112) == 0) {
    DoorRight11.Visible = true ;
    PlaySound(2);
    SetGlobalInt(112, 1) ;
  }
  else player.Talk("This door is already open."); 
}

else if (Action == aClose) {
  if (GetGlobalInt(112) == 1) {
    DoorRight11.Visible = false ;
    PlaySound(3);
    SetGlobalInt(112, 0);
  }
  else player.Talk("This door is already closed.");
}


}

Linke Tür hat den Script-Namen: hDoorLeft11
Rechte Tür hat den Script-Namen: hDoorRight11

Prinzipiell habe ich das Script von Hotspot 1  (linke Tür)  per Copy/Paste in das Script von Hotspot 2  (rechte Tür) eingefügt und die Algorithmen dem Hotspot 2 angepasst. Also müsste das doch eigentlich gehen.


BG
der Volltanker


"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

Endres

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1264
  • Geschlecht: Männlich
  • En|dres, der
    • ICQ Messenger - 230191486
    • MSN Messenger - enni_puschner@hotmail.de
    • Profil anzeigen
    • e7p.de
    • E-Mail
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #1 am: 24. Oktober 2010, 22:04:01 »
hast du dem zweiten Hotspot das Skript zugewiesen?


Domi:"irc hab ich mir viren geholt.. icq hab ich nimmer"

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #2 am: 25. Oktober 2010, 14:49:53 »
hast du dem zweiten Hotspot das Skript zugewiesen?

Ja. Ziemlich sicher. Wie Du auch in dem Script-Code sehen kannst. Wenn ich das Script von Hotspot 2 editiere, dann taucht auch der Tasten-Cursor hinter dem
function hDoorRight11_AnyClick()
auf. Und das Script ist ja auch genau innerhalb dieser Funktionsklammern geschrieben.

Oder muss man evtl. sogar noch abschließend sowas wie
endfunction xy schreiben?

Was könnte denn sonst der Fehler sein?


BG
der Volltanker

"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

Endres

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1264
  • Geschlecht: Männlich
  • En|dres, der
    • ICQ Messenger - 230191486
    • MSN Messenger - enni_puschner@hotmail.de
    • Profil anzeigen
    • e7p.de
    • E-Mail
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #3 am: 25. Oktober 2010, 15:00:43 »
Oder muss man evtl. sogar noch abschließend sowas wie
endfunction xy schreiben?
Nein, das wird ja durch die geschweiften Klammern impliziert.

Sorry, aber ansonsten kann ich da keinen Fehler erkennen. Ich sortiere und vereinfache dann immer erstmal den Code, dabei sehe ich, ob eventuell eine offene Klammer zuviel ist oder so.
function hDoorLeft11_AnyClick() {
  if(Action == aOpen) {
    if(GetGlobalInt(111) == 0) {
      DoorLeft11.Visible = true;
      PlaySound(2);
      SetGlobalInt(111, 1);
    } else player.Talk("This door is already open.");  
  } else if(Action == aClose) {
    if(GetGlobalInt(111) == 1) {
      DoorLeft11.Visible = false;
      PlaySound(3);
      SetGlobalInt(111, 0);
    } else player.Talk("This door is already closed.");
  }
}

function hDoorRight11_AnyClick() {
  if(Action == aOpen) {
    if(GetGlobalInt(112) == 0) {
      DoorRight11.Visible = true;
      PlaySound(2);
      SetGlobalInt(112, 1);
    } else player.Talk("This door is already open.");  
  } else if(Action == aClose) {
    if(GetGlobalInt(112) == 1) {
      DoorRight11.Visible = false;
      PlaySound(3);
      SetGlobalInt(112, 0);
    } else player.Talk("This door is already closed.");
  }
}

Wäre es hierbei nicht gleich sinnvoller eine eigene Türfunktion zu machen? (Gibt es übrigens auch schon, hat mal jemand gemacht ;) )
function door(int GI, object* obj) { // Keine Garantie, bin AGS 3x geschadet ;)
  if(Action == aOpen) {
    if(GetGlobalInt(GI) == 0) {
      obj.Visible = true;
      PlaySound(2);
      SetGlobalInt(GI, 1);
    } else player.Talk("This door is already open."); 
  } else if(Action == aClose) {
    if(GetGlobalInt(GI) == 1) {
      obj.Visible = false;
      PlaySound(3);
      SetGlobalInt(GI, 0);
    } else player.Talk("This door is already closed.");
  }
}

function hDoorLeft11_AnyClick()  { door(111, DoorLeft11); }
function hDoorRight11_AnyClick() { door(112, DoorRight11); }
« Letzte Änderung: 25. Oktober 2010, 15:04:24 von Endres »


Domi:"irc hab ich mir viren geholt.. icq hab ich nimmer"

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #4 am: 25. Oktober 2010, 17:33:35 »
Hmm.

Ich habe gerade festgestellt, dass das Basis-Script schon so einige Fehler beinhaltet. Muss erst mal gucken, ob ich das mit Hilfe einer Starterpak-Vorlage repariert bekomme.


BG
der Volltanker
"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

KhrisMUC

  • Moderator
  • volljähriger Tentakel
  • *****
  • Beiträge: 988
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #5 am: 25. Oktober 2010, 18:33:29 »
Für Türen gibts doch extra die eingebaute Funktion:
function any_click_on_door_special (int GI, Object *objekt, int x, int y, eDirection dir, int nr_room, int nr_x, int nr_y, eDirection nr_dir, int opensound, int closesound, int key, int closevalue)

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #6 am: 25. Oktober 2010, 19:44:38 »
Für Türen gibts doch extra die eingebaute Funktion:
function any_click_on_door_special (int GI, Object *objekt, int x, int y, eDirection dir, int nr_room, int nr_x, int nr_y, eDirection nr_dir, int opensound, int closesound, int key, int closevalue)

Diese ist in dem C64-Script, das ich von LUniqueDan bekommen habe, glaub ich noch gar nicht einprogrammiert. Deswegen habe ich da jetzt die GlobalInts verwendet.
Das kann jetzt aber noch nicht das Kernproblem sein.

Kommt das bei AGS 3.1.2. häufiger vor, dass eine function hHotspot1 () einwandfrei funktioniert und das Programm das Script zu fuction hHotspot2 () gleichzeitig völlig ignoriert?

Hier jetzt einmal sämtliche Scripts:

GlobalScript.ash
// Main header script - this will be included into every script in
// the game (local and global). Do not place functions here; rather,
// place import definitions and #define names here to be used by all
// scripts.

// +++ The following are not necessary but Cool functions +++
    import function Black();
    import function Back();
    import function UHE();
    import function FaceNorth(this Character*);
    import function FaceSouth(this Character*);
    import function FaceWest(this Character*);
    import function FaceEast(this Character*);
   
    import function Talk(this Character*, String What);
   

// +++ The followings is made to simplify lives +++++++++++++
enum ACTION
        {
        aPush,   aPull,  aGive,
        aOpen, aClose,   aUse, 
        aWalkTo, aPickUp, aLookAt,
        aTalkTo, aTurnOn,  aTurnOff,
        };
       
       


GlobalScript.asc
// main global script file

function APPLY_CUSTOM()
{
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// XXXXXX  XX   XX  XXXXXX  XXXXXXXX  XXXXXXX  XXX     XXX     
// XX      XX   XX  XX         XX     XX   XX  XX XX XX XX 
// XX      XX   XX  XXXXXX     XX     XX   XX  XX   X   XX 
// XX      XX   XX      XX     XX     XX   XX  XX       XX 
// XXXXXX  XXXXXXX  XXXXXX     XX     XXXXXXX  XX       XX 
//
//
//  XXXXXX  XXXXXXXX  XXX  XX  XXXXXX  XXXXXX  (TM)
//  XX         XX     XX   XX  XX      XX
//  XXXXXX     XX     XX   XX  XXXX    XXXX
//      XX     XX     XX   XX  XX      XX 
//  XXXXXX     XX     XXXXXXX  XX      XX 
//
//
//----------------------------------------------
// Set the player Here using their SCRIPT names
//----------------------------------------------
PLAYER_1ID = cSyd;
PLAYER_2ID = cHoagie;
PLAYER_3ID = cRazor;
//----------------------------------------------
//
//
//----------------------------------------------
// Choose the colors of Things
//----------------------------------------------
COLOR_ACT_LINE_NORMAL = 35381;
COLOR_ACT_LINE_MOUSEOVER = 55023;

COLOR_INV_NORMAL = 35381;
COLOR_INV_MOUSEOVER = 55023;

COLOR_CHANGE_P_NORMAL = C64COLOR_PBLUE;
COLOR_CHANGE_P_MOUSEOVER = 55023;
//----------------------------------------------


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}





// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function Reset_Line()
{
mouse.Mode = eModeWalkto;
Action_Verb = "Walk to";
LblAction.Text = "Walk to";
Action = aWalkTo;
}

function Black()
    {
    gMainGui.Visible = false;
    mouse.Visible = false;
    LblAction.Visible = false;
    LBL_MESSAGE_TOP.Text = ""; // black will always erase this one.
    }

function Back()
    {
    gMainGui.Visible = true;
    mouse.Visible = true;
    LblAction.Visible = true;
    }
   
function Talk(this Character*, String What)
{
LBL_MESSAGE_TOP.TextColor = this.SpeechColor;
LBL_MESSAGE_TOP.Text = What;
int tempo = this.View;
this.StopMoving(); // just to be sure

int Cmpt =0;
String Empty = "  ";
while (Cmpt < What.Length)
    {
    Empty = String.Format("%s ",Empty);
    Cmpt++;
    } 
this.Say(Empty);
LBL_MESSAGE_TOP.Text = "";
Reset_Line();
}   
   
   
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
      function FaceNorth(this Character*) {this.FaceLocation(this.x, 0, eBlock);}
      function FaceSouth(this Character*) {this.FaceLocation(this.x, 300, eBlock);}
      function FaceWest(this Character*) {this.FaceLocation(0,this.y, eBlock);}
      function FaceEast(this Character*) {this.FaceLocation(1000, this.y, eBlock);}


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function UPDATE_ACTION()
    {
    LblAction.Text = Action_Verb;
    }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function New_Player(Character* WhoSNext)
{
 
Black(); 
// +++ Visual Show again Character ++++++++++++++++
bChangeP1.Visible = true; lChangeP1.Visible = true;
bChangeP2.Visible = true; lChangeP2.Visible = true;
bChangeP3.Visible = true; lChangeP3.Visible = true;
// ++++++++++++++++++++++++++++++++++++++++++++++++

// +++ Erase the next player button +++++++++++++++
if (lChangeP1.Text == WhoSNext.Name){bChangeP1.Visible = false; lChangeP1.Visible = false;}
if (lChangeP2.Text == WhoSNext.Name){bChangeP2.Visible = false; lChangeP2.Visible = false;}
if (lChangeP3.Text == WhoSNext.Name){bChangeP3.Visible = false; lChangeP3.Visible = false;}
// ++++++++++++++++++++++++++++++++++++++++++++++++

if (player.Room == WhoSNext.Room)
    {
    if (Room.Width > 320){// transitional room so scroll
        int Cmpt = GetViewportX();
        int Dest = WhoSNext.x;
        if (player.x > Dest) {        // SCROLL RIGHT
            while(Cmpt > Dest-160)
                  {
                  SetViewport(Cmpt, GetViewportY());
                  Cmpt=Cmpt-4;
                  Wait(1);
                  }
            }
           
        else  {                   // SCROLL LEFT
            while(Cmpt < Dest-160)
              {
              SetViewport(Cmpt, GetViewportY());
              Cmpt=Cmpt+4;
              Wait(1);
              }
            }
        }
      ReleaseViewport(); 
    }
    WhoSNext.SetAsPlayer(); 
    Back();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++














// A function that initializes a bunch of stuff.
function initialize_control_panel() {
  // Centre the control panel
  gPanel.Centre();
  // Centre the Restart dialog as well
  gRestartYN.Centre();
  if (!IsSpeechVoxAvailable()) {
    // If there is no speech-vox file, and therefore no speech,
    // disable all the controls related with speech.
    lblVoice.Visible = false; 
    btnVoice.Visible = false; 
    sldVoice.Visible = false;
  }
  else {
    // If there *is*, then set it to voice and text. It's best to use
    // both whenever possible, for the player's sake.
    SetVoiceMode(eSpeechVoiceAndText);
    // And reflect this in the control panel.
    btnVoice.Text = "Voice and Text";
  }
  if (!System.SupportsGammaControl) {
    // If we can't change the gamma settings, disable the relevant options.
    sldGamma.Visible = false;
    lblGamma.Visible = false;
  }
 
  //And now, set all the defaults
  SetMusicMasterVolume(100);
  sldMusic.Value = 200;
  sldSound.Value = 200;
  SetSoundVolume(200);
  SetGameSpeed(40);
  sldSpeed.Value = 40;
  if (IsSpeechVoxAvailable()) {
     SetVoiceMode(eSpeechVoiceAndText);
     btnVoice.Text = "Voice and Text";
     sldVoice.Value = 255;
     SetSpeechVolume(255);
  }
  if (System.SupportsGammaControl) {
    System.Gamma = 100;
    sldGamma.Value = 100;
  }
}

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



// Called when the game starts, before the first room is loaded
function game_start() {   


  initialize_control_panel();
  APPLY_CUSTOM();
 
  // ++++ STEP 1 - JUST BEING SURE The verbs buttons are on the same ROW ++++
  bOpen.Y = bPush.Y;   bWalkTo.Y = bPush.Y;  bTalkTo.Y = bPush.Y;  bChangeP1.Y = bPush.Y;  // Row1
  bClose.Y = bPull.Y;  bPickUp.Y = bPull.Y;  bTurnOn.Y = bPull.Y;  bChangeP2.Y = bPull.Y;  // Row2
  bUse.Y = bGive.Y;    bLookAt.Y = bUse.Y;   bTurnOff.Y = bGive.Y; bChangeP3.Y = bGive.Y;  // Row3
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
  // ++++ STEP 2 - JUST BEING SURE The verbs buttons are on the same Columns ++++
  bPull.X = bPush.X;      bGive.X = bPush.X;             //Column1
  bClose.X = bOpen.X;     bUse.X = bOpen.X;              //Column2
  bPickUp.X = bWalkTo.X;  bLookAt.X = bWalkTo.X;         //Column3
  bTurnOn.X = bTalkTo.X;  bTurnOff.X = bTalkTo.X;        //Column4
  bChangeP2.X = bChangeP1.X;  bChangeP3.X = bChangeP1.X; //Column5
  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
  // ++++ STEP 3 - JUST BEING SURE EVERYTHING IS ALIGN ON THE WORD INV ++++
  cinvent1hg.Y = bGive.Y+bGive.Height+3;
  cinvent2hd.Y = cinvent1hg.Y; // Hidden top-Right Button
  cinvent3bg.Y = cinvent1hg.Y+cinvent1hg.Height;
  cinvent4bd.Y = cinvent3bg.Y; // Hidden Bottom-Right Button
 
  linv1hg.SetPosition(cinvent1hg.X, cinvent1hg.Y); // Top-left Label over Top-left Hidden Button
  linv2hd.SetPosition(cinvent2hd.X, cinvent2hd.Y); // Top-right Label over Top-right Hidden Button
  linv3bg.SetPosition(cinvent3bg.X, cinvent3bg.Y); // Bottom-left Label over Bottom-left Hidden Button
  linv4bd.SetPosition(cinvent4bd.X, cinvent4bd.Y); // Bottom-right Label over Bottom-right Hidden Button
 
  btnInvU2.Y = cinvent1hg.Y;
  bINV_Down.Y = cinvent3bg.Y;
  bINV_Down.X = btnInvU2.X;
 
 
  bChangeP2.X = bChangeP1.X; bChangeP3.X = bChangeP3.X;
  lChangeP1.SetPosition(bChangeP1.X, bChangeP1.Y);
  lChangeP2.SetPosition(bChangeP2.X, bChangeP2.Y);
  lChangeP3.SetPosition(bChangeP3.X, bChangeP3.Y);
 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 

 
 
 // ++++ STEP 3 - BECAUSE USUALLY PPL STARTS WITH NO INV ++++++++++++++++++++
 // (DON'T PANIC - If it's not the case it will be reajusted automatically)
 btnInvU2.Visible = false;
 bINV_Down.Visible = false;
 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
 
  // ++++ STEP 4 - TO MAKE EVERYTHING COOL AND FINE +++++++++++++++++++++++++
  // Nice looking start (TM)
  Action = aWalkTo;
  Action_Verb = "Walk to";
  Action_Object = "";
  mouse.Mode = eModeWalkto;
 
  lChangeP1.Text = PLAYER_1ID.Name; lChangeP1.TextColor = 32281;
  lChangeP2.Text = PLAYER_2ID.Name; lChangeP2.TextColor = 32281;
  lChangeP3.Text = PLAYER_3ID.Name; lChangeP3.TextColor = 32281;
 
  // Erase the actual player button
  if (player.Name == lChangeP1.Text) {bChangeP1.Visible = false; lChangeP1.Visible = false;}
  if (player.Name == lChangeP2.Text) {bChangeP2.Visible = false; lChangeP2.Visible = false;}   
  if (player.Name == lChangeP3.Text) {bChangeP3.Visible = false; lChangeP3.Visible = false;}
 
  // Erase contains of the top line
  LBL_MESSAGE_TOP.Text = "";
 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 
}

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


function repeatedly_execute() {
 
  // put anything you want to happen every game cycle, even when
  // the game is paused, here
 
  if (IsGamePaused() == 1) return;

  // put anything you want to happen every game cycle, but not
  // when the game is paused, here


//*************************************************
// Because There is of Scrolling Rooms
int RPosX = mouse.x + GetViewportX();
int RPosY = mouse.y + GetViewportY();
String Ecran= Game.GetLocationName(mouse.x, mouse.y);
String Verbe_Aff = Action_Verb;
//*************************************************





// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//++++++++ STEP 1 - AUTO_COLOR THE GUI

// ACTION LINE
// PUSH
// PULL
// GIVE
// -------------------------------------------------------------
// TOP-LEFT INVENTORY      |UP BUTTON | TOP-RIGHT INVENTORY
// DOWN-LEFT INVENTORY     |D. BUTTON | BOTTOM-RIGHT INVENTORY
// -------------------------------------------------------------

int TOP_ACT_LINE = gActionLine.Y;
int BOT_ACT_LINE = gActionLine.Y + gActionLine.Height;

int TOP_ROW_TOP = gMainGui.Y + cinvent1hg.Y;
int TOP_ROW_BTM = gMainGui.Y+ cinvent1hg.Y + cinvent1hg.Height -1;

int BTM_ROW_TOP = gMainGui.Y + cinvent3bg.Y;
//no need for BTM_ROM_BTM (nothing else down here)

int ROW_P1 = gMainGui.Y + bChangeP1.Y;
int ROW_P2 = gMainGui.Y + bChangeP2.Y;
int ROW_P3 = gMainGui.Y + bChangeP3.Y;

if (mouse.Visible == true) // if the mouse is not visible then it will no bother with that
    {
    // Top to down
    if (mouse.y >= TOP_ACT_LINE && mouse.y < BOT_ACT_LINE){ LblAction.TextColor = 55023; Action_Object="";}
    else LblAction.TextColor = COLOR_ACT_LINE_NORMAL;

    if (mouse.y >= BTM_ROW_TOP && mouse.x < bINV_Down.X && linv3bg.Text!=null) {linv3bg.TextColor = 55023;Action_Object = linv3bg.Text;}
    else linv3bg.TextColor = 35381;
   
    if (mouse.y >= BTM_ROW_TOP && mouse.x > bINV_Down.X+bINV_Down.Width&& linv4bd.Text!=null){ linv4bd.TextColor = 55023;Action_Object = linv4bd.Text;}
    else linv4bd.TextColor = 35381;
   
    if (mouse.y >= TOP_ROW_TOP && mouse.x < bINV_Down.X && mouse.y <= TOP_ROW_BTM&& linv1hg.Text!=null){ linv1hg.TextColor = 55023;Action_Object = linv1hg.Text;}
    else linv1hg.TextColor = 35381;
   
    if (mouse.y >= TOP_ROW_TOP && mouse.x > bINV_Down.X+bINV_Down.Width && mouse.y <= TOP_ROW_BTM && linv2hd.Text!=null){ linv2hd.TextColor = 55023;Action_Object = linv2hd.Text;}
    else linv2hd.TextColor = 35381;
   
   
    if (mouse.x >= bChangeP1.X)
        {
        if (mouse.y >= ROW_P1 && mouse.y < ROW_P2) lChangeP1.TextColor = 55023;
        else lChangeP1.TextColor = 32281;
       
        if (mouse.y >= ROW_P2 && mouse.y < ROW_P3) lChangeP2.TextColor = 55023;
        else lChangeP2.TextColor = 32281;
       
        if (mouse.y >= ROW_P3 && mouse.y < ROW_P3+ bChangeP3.Height) lChangeP3.TextColor = 55023;
        else lChangeP3.TextColor = 32281;
        }
    else
        {
        lChangeP1.TextColor = 32281;
        lChangeP2.TextColor = 32281;
        lChangeP3.TextColor = 32281;
        }
   
    if (mouse.y < TOP_ROW_TOP) Action_Object=""; // Remove selection
    }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//-------------------------------------------------

if (Action_Object == null) Action_Object = "";
if (Ecran == null) Ecran = "";

if (Action_Verb == null || Action_Verb == "") {Action_Verb = "Walk to (acV)"; Action = aWalkTo; mouse.Mode = eModeWalkto;}
String Line = "";

//-------------------------------------------------

// +++++++++++ NOW LET'S UPDATE THAT ACTION LINE
if (Action == aGive){
      if (GetLocationType(mouse.x, mouse.y) != eLocationCharacter) Ecran = ""; // Can't give to object or hotspot
 
      if (player.ActiveInventory == null && Action_Object == "") Line = String.Format("Give ");
      else if (player.ActiveInventory == null && Action_Object != "") Line = String.Format("Give %s",Action_Object);
      else if (player.ActiveInventory != null) Line = String.Format("Give %s to %s",player.ActiveInventory.Name, Ecran);
      }

else if (Action ==aUse)
    {
     if (player.ActiveInventory == null && Action_Object == "") Line = String.Format("Use ");
     else if (player.ActiveInventory == null && Action_Object != "") Line = String.Format("Use %s", Action_Object);
     else if (player.ActiveInventory != null && Action_Object == "") Line = String.Format("Use %s with %s",player.ActiveInventory.Name, Ecran);
     else if (player.ActiveInventory != null && Action_Object != "")Line = String.Format("Use %s with %s",player.ActiveInventory.Name, Action_Object);
    }

else
    {
    if (Ecran == "") Ecran = Action_Object; // olny here (can't give with inventory)
    Line = String.Format("%s %s",Action_Verb, Ecran);
    }

LblAction.Text = Line;

}









// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


function repeatedly_execute_always()
{
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// STEP 1 - Update Inventory buttons Up and Down
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (gMainGui.Visible == true) // If not visible, it's a waste of time
      {
if (INV_Hidden.TopItem > 0)
btnInvU2.Visible = true;

else
btnInvU2.Visible = false;

if ((INV_Hidden.TopItem + 4) > (INV_Hidden.ItemCount-1))
bINV_Down.Visible = false;

else
bINV_Down.Visible = true;


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// STEP 2 - Update labels of the visible inventory
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        // +++ A - Top-Left Label
if (INV_Hidden.ItemCount>0)
linv1hg.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem].Name;
else
linv1hg.Text ="";

        // +++ B - Top-Right Label
if (INV_Hidden.ItemCount>1 && (INV_Hidden.TopItem+1 < INV_Hidden.ItemCount))
linv2hd.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1].Name;
else
linv2hd.Text ="";

// +++ C - Bottom-Left Label
if (INV_Hidden.ItemCount>2 && (INV_Hidden.TopItem+2 < INV_Hidden.ItemCount))
linv3bg.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2].Name;
else
linv3bg.Text ="";

// +++ D - Bottom-Right Label
if (INV_Hidden.ItemCount>3 && (INV_Hidden.TopItem+3 < INV_Hidden.ItemCount))
linv4bd.Text = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3].Name;
else
linv4bd.Text ="";
      }

}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++













function show_save_game_dialog()
{
  gSaveGame.Visible = true;
  // Get the list of save games
  lstSaveGamesList.FillSaveGameList();
  if (lstSaveGamesList.ItemCount > 0)
  {
    // If there is at least one, set the default text
    // to be the first game's name
    txtNewSaveName.Text = lstSaveGamesList.Items[0];
  }
  else
  {
    // No save games yet, default empty text.
    txtNewSaveName.Text = "";
  }
  mouse.UseModeGraphic(eModePointer);

}

function show_restore_game_dialog()
{
  gRestoreGame.Visible = true;
  lstRestoreGamesList.FillSaveGameList();
  mouse.UseModeGraphic(eModePointer);

}

function close_save_game_dialog()
{
  gSaveGame.Visible = false;
  mouse.UseDefaultGraphic();

}

function close_restore_game_dialog()
{
  gRestoreGame.Visible = false;
  mouse.UseDefaultGraphic();
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function unhandled_event (int what, int type)
{
if (Action == aLookAt) player.Talk ("I see nothing special.");
else if (Action == aOpen) player.Talk("There's nothing to open.");
else if (Action == aPickUp) player.Talk("I can't pick that up.");
else if (Action == aPull || Action==aPush) player.Talk("I can't move that.");
else player.Talk("That doesn't work."); 

player.ActiveInventory = null;

}

function UHE()
{
unhandled_event(1, 1);
}

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






// Called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode) {
  // The following is called before "if game is paused keycode=0", so
  // it'll happen even when the game is paused.
 
  if ((keycode == eKeyEscape) && gRestartYN.Visible) {
    //Use ESC to cancel restart.
    gRestartYN.Visible = false;

    // If the panel's not ON, then the player must have gotten here by tapping F9,
    // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
    // because it's already a pointer. Get used to thinking like this!!
    if (!gPanel.Visible) mouse.UseDefaultGraphic();
    return;
  }
  if ((keycode == eKeyEscape) && gPanel.Visible) {
    // Use ESC to turn the panel off.
    gPanel.Visible = false;
    mouse.UseDefaultGraphic();

    return;
  }
  if ((keycode == eKeyEscape) && (gSaveGame.Visible))
  {
    // Use ESC to close the save game dialog
    close_save_game_dialog();
    return;
  }
  if ((keycode == eKeyEscape) && (gRestoreGame.Visible))
  {
    // Use ESC to close the restore game dialog
    close_restore_game_dialog();
    return;
  }
 
  if (keycode == eKeyReturn) {
    // ENTER, in this case merely confirms restart
    if (gRestartYN.Visible) RestartGame();
  }

  if (IsGamePaused() || (IsInterfaceEnabled() == 0))
  {
    // If the game is paused with a modal GUI on the
    // screen, or the player interface is disabled in
    // a cut scene, ignore any keypresses.
    return;
  }

  // FUNCTION KEYS AND SYSTEM SHORTCUTS
  if (keycode == eKeyEscape) {
    // ESC
    gPanel.Visible = true;

    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyCtrlQ)  QuitGame(1);   // Ctrl-Q
  if (keycode == eKeyF5) show_save_game_dialog();   // F5
  if (keycode == eKeyF7) show_restore_game_dialog();  // F7
  if (keycode == eKeyF9) {
    // F9, asks the player to confirm restarting (so much better to always confirm first)
    gRestartYN.Visible = true; 

    mouse.UseModeGraphic(eModePointer);
  }
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp");  // F12


  // GAME COMMAND SHORTCUTS
    if (keycode == 'Q'){Action_Verb = "Push"; Action = aPush; Mouse.Mode = eModePuPuTonTo ;}
    if (keycode == 'A'){Action_Verb = "Pull"; Action = aPull; Mouse.Mode = eModePuPuTonTo ;}
    if (keycode == 'Z'){Action_Verb = "Give"; Action = aGive; Mouse.Mode = eModeInteract ;}

    if (keycode == 'W') {Action_Verb = "Open"; Action = aOpen; Mouse.Mode = eModeOpenClose ;}
    if (keycode == 'S') {Action_Verb = "Close"; Action = aClose; Mouse.Mode = eModeOpenClose ;}
    if (keycode == 'X') {Action_Verb = "Use"; Action = aPush; Mouse.Mode = eModeInteract ;}
 
    if (keycode == 'E') {Action_Verb = "Walk to"; Action = aWalkTo; Mouse.Mode = eModeWalkto ;}
    if (keycode == 'D') {Action_Verb = "Pick up"; Action = aPickUp; Mouse.Mode = eModePickup ;}
    if (keycode == 'C') {Action_Verb = "Look At"; Action = aLookAt; Mouse.Mode = eModeLookat ;}

    if (keycode == 'R') {Action_Verb = "Talk To"; Action = aTalkTo; Mouse.Mode = eModeTalkto ;}
    if (keycode == 'F') {Action_Verb = "Turn on"; Action = aTurnOn; Mouse.Mode = eModePuPuTonTo ;}
    if (keycode == 'V') {Action_Verb = "Turn off"; Action = aTurnOff; Mouse.Mode = eModePuPuTonTo ;}


  // For extra cursor modes, such as pick up, feel free to add as you will.
  // Uncomment the line below if you use the "Pick Up" mode.
  //if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup;

  // DEBUG FUNCTIONS
  if (keycode == eKeyCtrlS)  Debug(0,0);  // Ctrl-S, give all inventory
  if (keycode == eKeyCtrlV)  Debug(1,0);  // Ctrl-V, version
  if (keycode == eKeyCtrlA)  Debug(2,0);  // Ctrl-A, show walkable areas
  if (keycode == eKeyCtrlX)  Debug(3,0);  // Ctrl-X, teleport to room
  if (keycode == eKeyCtrlW && game.debug_mode)
    player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area
}


function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft || button==eMouseRight)
      {
      //*************************************
      // Because There is of Scrolling Rooms
      int RPosX = mouse.x + GetViewportX();
      int RPosY = mouse.y + GetViewportY();
      Character* ThatGuy;
      Object* ThatObject;
      Hotspot* ThatSpot;
      //*************************************

   
   
      // Case 1 - Click Nowhere gave you walk
      if (mouse.Mode != eModeWalkto && Game.GetLocationName(mouse.x, mouse.y) == "")
            {
            mouse.Mode = eModeWalkto;
            Action = aWalkTo;
            Action_Verb = "Walk to";
            }
           
      else if (mouse.Mode == eModeWalkto)
            {
            ProcessClick(mouse.x, mouse.y, eModeWalkto); 
            }


      // ++++ AUTO Case 1 - Give olny to Character
            // Char Auto Give
       else if (Action == aGive)
                {
                if (player.ActiveInventory != null && GetLocationType(mouse.x, mouse.y) == eLocationCharacter) // automatik
                      {                 
                      ThatGuy = Character.GetAtScreenXY(mouse.x, mouse.y);                     
                      if (ThatGuy == cRazor || ThatGuy == cHoagie || ThatGuy == cSyd)
                          {   
                          if (ThatGuy.x > player.x+30)player.Walk(ThatGuy.x-30, ThatGuy.y,  eBlock, eWalkableAreas);
                          else if (ThatGuy.x < player.x +30)player.Walk(ThatGuy.x+30, ThatGuy.y,  eBlock, eWalkableAreas);
                          else {} // don't move they are exanging stuff
                          player.FaceCharacter(ThatGuy, eBlock);
                          ThatGuy.FaceCharacter(player, eBlock);
                          ThatGuy.AddInventory(player.ActiveInventory);
                          player.LoseInventory(player.ActiveInventory);
                          }
                      else // Give to Other Character
                          {
                          // ThatGuy.RunInteraction(eModeUseinv);
                          ProcessClick(RPosX, RPosY,  mouse.Mode);
                          }
                        }
                else {} // Don't give it's an object or an hospot
                }
   
      // Any others verb or action
      else
            {
            ProcessClick(RPosX, mouse.y, mouse.Mode );
            }
        }

  else if (button == eMouseMiddle) {ProcessClick(mouse.x, mouse.y, eModeWalkto); }

  else if (button == eMouseWheelNorth) {
    // Mouse-wheel up, cycle cursors
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1;
    else
    {
      // ...but if it is WALK mode...
      if (player.ActiveInventory!=null)
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv.
        mouse.Mode=eModeUseinv;
      }
      else
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto;
      }
    }
  }
}




//START OF CONTROL PANEL FUNCTIONS
function btnSave_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
  Wait(1);
}

function btnQuit_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  Wait(1);
  QuitGame(1);
  gPanel.Visible = true;
  mouse.UseModeGraphic(eModePointer);
}

function btnLoad_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
  Wait(1);
}

function btnResume_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
}

function sldMusic_OnChange(GUIControl *control)
{
  SetMusicMasterVolume(sldMusic.Value); 
}

function sldSound_OnChange(GUIControl *control)
{
  // This sets the sound volume. Note it'll also affect MOD and XM music - read the manual
  SetSoundVolume(sldSound.Value);
}

function sldVoice_OnChange(GUIControl *control)
{
  // Sets voice volume. Note that we don't check for the existence of speech.vox -
  // we did that in game_start, so if it's not there the slider won't even be available.
  SetSpeechVolume(sldVoice.Value);
}

function btnVoice_OnClick(GUIControl *control, MouseButton button)
{
  // Note that we don't check for the existence of speech.vox - we did that in game_start,
  // so if it's not there the button won't even be available.
  if (btnVoice.Text == "Voice and Text") {
    SetVoiceMode(eSpeechVoiceOnly);
    btnVoice.Text = "Voice only";
  }
  else if (btnVoice.Text == "Voice only") {
    SetVoiceMode(eSpeechTextOnly);
    btnVoice.Text = "Text only";
  }
  else if (btnVoice.Text == "Text only") {
    SetVoiceMode(eSpeechVoiceAndText);
    btnVoice.Text = "Voice and Text";
  }
}

function sldGamma_OnChange(GUIControl *control)
{
  // Set the gamma. Note there's no need to check for anything else, as we ensured,
  // in game_start, that the slider won't even appear if it's not possible to do this.
  System.Gamma = sldGamma.Value;
}

function btnDefault_OnClick(GUIControl *control, MouseButton button)
{
  // Reset everything to default. You'll have to edit these as well as the sliders
  // if you'd rather have different default parameters.
  SetMusicMasterVolume(100);
  sldMusic.Value = 200;
  sldSound.Value = 200;
  SetSoundVolume(200);
  sldSpeed.Value = 40;
  SetGameSpeed(40);
  if (IsSpeechVoxAvailable()) {
     SetVoiceMode(eSpeechVoiceAndText);
     btnVoice.Text = "Voice and Text";
     sldVoice.Value = 255;
     SetSpeechVolume(255);
  }
  if (System.SupportsGammaControl) {
    System.Gamma = 100;
    sldGamma.Value = 100;
  }
}
//END OF CONTROL PANEL FUNCTIONS




function sldSpeed_OnChange(GUIControl *control)
{
  SetGameSpeed(sldSpeed.Value);
}

function btnRestart_OnClick(GUIControl *control, MouseButton button)
{
  gRestartYN.Visible=true;
}

function btnRestartYes_OnClick(GUIControl *control, MouseButton button)
{
  RestartGame();
}

function btnRestartNo_OnClick(GUIControl *control, MouseButton button)
{
  gRestartYN.Visible = false;

  // If the panel's not ON, then the player must have gotten here by tapping F9,
  // therefore his cursor needs restoring. If the panel IS on, then it doesn't,
  // because it's already a pointer. Get used to thinking like this!!
  if (!gPanel.Visible) mouse.UseDefaultGraphic();
}


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// The folowings are For The save / Load dialogs

function btnCancelSave_OnClick(GUIControl *control, MouseButton button)
{
  close_save_game_dialog();
}

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items[i] == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i];
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();
}

function btnCancelRestore_OnClick(GUIControl *control, MouseButton button)
{
  close_restore_game_dialog();
}

function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
  if (lstRestoreGamesList.SelectedIndex >= 0)
  {
    RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
  }
  close_restore_game_dialog();
}

function lstSaveGamesList_OnSelectionCh(GUIControl *control)
{
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex];
}

function txtNewSaveName_OnActivate(GUIControl *control)
{
  // Pressing return in the text box simulates clicking the Save button
  btnSaveGame_OnClick(control, eMouseLeft);
}

function btnDeleteSave_OnClick(GUIControl *control, MouseButton button)
{
  if (lstSaveGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]);
    lstSaveGamesList.FillSaveGameList();
  }
}
// +++ End of the Save / load dialog
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++















// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++ ALL BUTTONS AND OPTIONS TO THE C64 GUI ARE DOWN HERE +++++++++++++++

// +++++++ Col1
function bPush_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Push";
    Action = aPush;
    Mouse.Mode = eModePuPuTonTo ; }

function bPull_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Push";
    Action = aPush;
    Mouse.Mode = eModePuPuTonTo ; }

function bGive_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Give";
    Action = aGive;
    Mouse.Mode = eModeInteract ; }

// +++++++ Col2
function bOpen_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Open";
    Action = aOpen;
    Mouse.Mode = eModeOpenClose ;}

function bClose_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Close";
    Action = aClose;
    Mouse.Mode = eModeOpenClose ; }

function bUse_OnClick(GUIControl *control, MouseButton button){
    Action_Verb = "Use";
    Action = aUse;
    Mouse.Mode = eModeInteract ;}

// +++++++ Col3
function bWalkTo_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Walk to";
    Action = aWalkTo;
    Mouse.Mode = eModeWalkto ; }
   
function bPickUp_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Pick up";
    Action = aPickUp;
    Mouse.Mode = eModePickup ;  }
   
function bLookAt_OnClick(GUIControl *control, MouseButton button){
    Action_Verb = "Look at";
    Action = aLookAt;
    Mouse.Mode = eModeLookat ;}
   
// +++++++ Col4
function bTalkTo_OnClick(GUIControl *control, MouseButton button){
    Action_Verb = "Talk to";
    Action = aTalkTo;
    Mouse.Mode = eModeTalkto ;}

function bTurnOn_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Turn on";
    Action = aTurnOn;
    Mouse.Mode = eModePuPuTonTo; }
   
function bTurnOff_Click(GUIControl *control, MouseButton button) {
    Action_Verb = "Turn off";
    Action = aTurnOff;
    Mouse.Mode = eModePuPuTonTo; }
       
function btnInvU2_OnClick(GUIControl *control, MouseButton button){Display("here");INV_Hidden.ScrollUp();}


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++ Button for changing the player
function bChangeP1_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_1ID);}

function bChangeP2_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_2ID);}

function bChangeP3_OnClick(GUIControl *control, MouseButton button){
New_Player(PLAYER_3ID);}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function cinvent1hg_Click(GUIControl *control, MouseButton button) {
    if (INV_Hidden.ItemCount>0 && (INV_Hidden.TopItem < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive) && player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem];
                      mouse.Mode = eModeUseinv;}
          else
               if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem].RunInteraction(mouse.Mode); 
}
}

function cinvent2hd_Click(GUIControl *control, MouseButton button) {
    if (INV_Hidden.ItemCount>1 && (INV_Hidden.TopItem+1 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1];
                      mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+1].RunInteraction(mouse.Mode);

}

function cinvent3bg_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>2 && (INV_Hidden.TopItem+2 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2];
                      mouse.Mode = eModeUseinv;}
else
if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+2].RunInteraction(mouse.Mode);// item sur item


}

function cinvent4bd_Click(GUIControl *control, MouseButton button) {
if (INV_Hidden.ItemCount>3 && (INV_Hidden.TopItem+3 < INV_Hidden.ItemCount))
{
if ((Action == aUse || Action == aGive)&& player.ActiveInventory == null){
player.ActiveInventory = INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3];
                      mouse.Mode = eModeUseinv;}
else
              if (Action != aGive) INV_Hidden.ItemAtIndex[INV_Hidden.TopItem+3].RunInteraction(mouse.Mode);

}





// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++ Exporting stuff

// Cool functions
export Black;
export Back;
export UHE;

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

























function iKey_Look()
{
player.Talk("It's a glowing key.");
}

function iChainsaw_Interact()
{
player.Talk("The chainsaw is out of gaz!");
}

function iDeadHamster_UseInv()
{
if (player.ActiveInventory == iGreenCrystal)
    {
    player.Talk("Yeah I'm using the green cristal on the Dead Hamster!");
    Black();
    Wait(40);
    Back();
    player.Talk("Wow! it Works!");
    player.LoseInventory(iDeadHamster);
    player.AddInventory(iHamsterAlive);
    }

else
    {
    UHE();
    }
}







function bINV_Down_OnClick(GUIControl *control, MouseButton button)
{
INV_Hidden.ScrollDown();
}

function dialog_request(int param) {
}


Room 11
// room script file

function room_FirstLoad()
{

SetGlobalInt(111, 0) ; // Door Corridor <--> Reception Room
SetGlobalInt(112, 0) ; // Door Reception Room <--> Backside Room

oDoorCorridor.Clickable = false ;
oDoorBackside.Clickable = false ;

}

function room_Load()
{
if (GetGlobalInt(111) == 0) oDoorCorridor.Visible = false ;
if (GetGlobalInt(111) == 1) oDoorCorridor.Visible = true;
if (GetGlobalInt(112) == 0) oDoorBackside.Visible = false;
if (GetGlobalInt(112) == 1) oDoorBackside.Visible = true;


}

function room_AfterFadeIn()
{

player.FaceSouth();

}



function hDoorCorridor_AnyClick()
{
player.Move(50, 128);
player.FaceWest();


if (Action == aWalkTo) {
  if (GetGlobalInt(111) == 1) player.ChangeRoom(10, 424, 125);
 
}

else if (Action == aOpen) {
  if (GetGlobalInt(111) == 0) {
    oDoorCorridor.Visible = true ;
    PlaySound(2);
    SetGlobalInt(111, 1) ;
  }
  else player.Talk("This door is already open."); 
}

else if (Action == aClose) {
  if (GetGlobalInt(111) == 1) {
    oDoorCorridor.Visible = false ;
    PlaySound(3);
    SetGlobalInt(111, 0);
  }
  else player.Talk("This door is already closed.");
}
else UHE();
}


function hDoorBackside_AnyClick()
{

player.Move(592, 131);
player.FaceEast();

if (Action == aWalkTo) {
 
}

else if (Action == aOpen) {
  if (GetGlobalInt(112) == 0) {
    oDoorBackside.Visible = true ;
    PlaySound(2);
    SetGlobalInt(112, 1) ;
  }
  else player.Talk("This door is already open."); 
}
else if (Action == aClose) {
  if (GetGlobalInt(112) == 1) {
    oDoorBackside.Visible = false ;
    PlaySound(3);
    SetGlobalInt(112, 0);
  }
  else player.Talk("This door is already closed.");
}
else UHE();

}




Anmerkung: Habe die Bezeichnungen der Einfachheit halber nochmal geändert.

Also wie gehabt, bei hDoorCorridor funktioniert das Öffnen und Schließen einwandfrei. Der Walk_to, um in den anderen Raum zu gelangen, hat wieder einmal überhaupt keine Funktion.
Die andere Tür in Room11 führt nur das Unhandled aus, obwohl das Script vorhanden ist.
In dem anderen Raum der hinter hDoorCorridor liegt, hat das Script mit der Tür ebenfalls keine Funktion genau wie bei Room11 hDoorBackside.


Wenn alles nix hilft, kann ich zuletzt ja immer noch das Ding an LUniqueDan schicken und den Fehler herausfinden, da er das Basis-Script auch programmiert hat.


BG
der Volltanker



"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

Endres

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1264
  • Geschlecht: Männlich
  • En|dres, der
    • ICQ Messenger - 230191486
    • MSN Messenger - enni_puschner@hotmail.de
    • Profil anzeigen
    • e7p.de
    • E-Mail
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #7 am: 25. Oktober 2010, 20:13:59 »
Kommt das bei AGS 3.1.2. häufiger vor, dass eine function hHotspot1 () einwandfrei funktioniert und das Programm das Script zu fuction hHotspot2 () gleichzeitig völlig ignoriert?
Grundsätzlich habe ich das Problem nicht. Man muss eben bei Hotspot 2 auch auf die drei Punkte (...) rechts in der Toolbox gehen...


Domi:"irc hab ich mir viren geholt.. icq hab ich nimmer"

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #8 am: 25. Oktober 2010, 22:02:31 »
Kommt das bei AGS 3.1.2. häufiger vor, dass eine function hHotspot1 () einwandfrei funktioniert und das Programm das Script zu fuction hHotspot2 () gleichzeitig völlig ignoriert?
Grundsätzlich habe ich das Problem nicht. Man muss eben bei Hotspot 2 auch auf die drei Punkte (...) rechts in der Toolbox gehen...

Habe ich gemacht. ;)
"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

KhrisMUC

  • Moderator
  • volljähriger Tentakel
  • *****
  • Beiträge: 988
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #9 am: 27. Oktober 2010, 20:02:09 »
Urg. Ich hab mir mal die on_mouse_click Funktion in LUniqueDan's Skript angeschaut:

function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft || button==eMouseRight)
      {

      [...]

      // Case 1 - Click Nowhere gave you walk
      if (mouse.Mode != eModeWalkto && Game.GetLocationName(mouse.x, mouse.y) == "")
            {
            mouse.Mode = eModeWalkto;
            Action = aWalkTo;
            Action_Verb = "Walk to";
            }

Wenn der Tür-Hotspot also keinen externen Namen hat, wird das ausgewählte Verb ignoriert.
Warum er so eine idiotische Methode verwendet hat, anstatt einfach "GetLocationType(...) == eLocationNothing" zu verwenden, wird wohl nicht mal er selbst beantworten können.

Ersetze die Stelle also einfach durch:

      // Case 1 - Click Nowhere gave you walk
      if (mouse.Mode != eModeWalkto && GetLocationType(mouse.x, mouse.y) == eLocationNothing)

Dann müsste es funktionieren.

Endres

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1264
  • Geschlecht: Männlich
  • En|dres, der
    • ICQ Messenger - 230191486
    • MSN Messenger - enni_puschner@hotmail.de
    • Profil anzeigen
    • e7p.de
    • E-Mail
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #10 am: 27. Oktober 2010, 20:05:16 »
Naja, welches Hotspot ist denn bitte nicht benannt... Daran liegts wahrscheinlich eher nicht  ::)


Domi:"irc hab ich mir viren geholt.. icq hab ich nimmer"

KhrisMUC

  • Moderator
  • volljähriger Tentakel
  • *****
  • Beiträge: 988
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #11 am: 27. Oktober 2010, 20:38:30 »
Ich meine nicht den Skriptnamen sondern die Beschreibung (Hotspot.Name). Die ist doch anfangs leer.
Ich ging einfach mal davon aus, dass 1mal_volltanken den Türen noch keine Beschreibungen verpasst hat.

Andererseits sehe ich gerade, dass in diesem Fall auch nicht UHE() ausgeführt werden würde sondern gar nix.

Warten wir mal lieber auf den Volltanker, bevor wir weitere voreilige Schlüsse ziehen, hmm?

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #12 am: 27. Oktober 2010, 20:40:48 »
Hallo.

Danke. Ich werd's morgen einfach mal ausprobieren. Heute komme ich leider nicht mehr dazu.


BG
der Volltanker
"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

1mal_volltanken

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1243
  • Geschlecht: Männlich
  • Traue niemals einem glatzköpfigen Friseur!
    • ICQ Messenger - 327646596
    • Profil anzeigen
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #13 am: 28. Oktober 2010, 15:21:54 »
Also es läuft soweit, dass sich auf beiden Seiten die Türen öffnen lassen und im anderen Raum funktioniert das Türenscript auch.

Nur, leider funktioniert das Raum-Wechsel-Script nicht.

Also unter der Action WALK TO habe ich ja ein player.ChangeRoom einprogrammiert. Nur leider wechselt er nicht in den nächsten Raum. Es passiert leider nix.
Woran könnte das denn jetzt liegen?

Außerdem war mir aufgefallen, dass nach einer erfolgreichen Interaktion die Action-Zeile nicht auf WALK TO zurückspringt. Wenn ich bspw. die Interaktion OPEN DOOR mache, öffnet sich die Tür, aber anstatt dass die Action-Bar auf Walk to zurückspringt, bleibt das Open stehen.

Bis dahin schon mal vielen Dank! ;)


BG
der Volltanker
 
"Tage sind eigentlich wie Nächte...nur nicht ganz so spät!"...hörte ich einmal einen sehr klugen, alten Mann beim Erdnüsse sortieren in der Kneipe sagen, kurz bevor er vom Hocker rutschte.


"Nicht jeder, der aus dem Rahmen fällt, war vorher im Bilde!"

Endres

  • Midlife Crisis Tentakel
  • ******
  • Beiträge: 1264
  • Geschlecht: Männlich
  • En|dres, der
    • ICQ Messenger - 230191486
    • MSN Messenger - enni_puschner@hotmail.de
    • Profil anzeigen
    • e7p.de
    • E-Mail
Re: Problem AnyClickonHotspot bei AGS 3.1.2.
« Antwort #14 am: 28. Oktober 2010, 15:29:17 »
Was spricht eigentlich gegen das MMM-Modul? Das GUI kannst du doch trotzdem vom anderen nehmen, oder?


Domi:"irc hab ich mir viren geholt.. icq hab ich nimmer"