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 - Eddie Chewbacca

#1
You're an absolute marvell.Ã,  That did the trick, thanks for that.Ã,  I'm annoyed with myself because I read about that setting and the RIGHTINV option, but I just didn't know how to get them working when I tried them out earlier, then I forgot all about them.Ã,  Any way thanks for all your help over the weeks, that should be the last time I bug any one for a while now, I hope.Ã,  :D
#2
The below code is how to change the speed of the FadeOut function.Ã,  Same goes for FadeIn functions.

FadeOut (int speed)

Fades the screen out to black. SPEED is the speed of the fade, from 1 (slowest) to 64 (instant). You can restore the screen with FadeIn.

Example: FadeOut(30);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  FadeIn(10);

Only thing I'm not sure of myself, being relatively new to AGS, is if you only need to set this variable once, or if it needs to be done in each room.Ã,  I'd assume you would only need to set it once, so maybe try adding the code in the global script under "game_start", or inÃ,  first room the charcater begins in, under "First Time Player Enters Screen" possibly.Ã,  You can of course change this for each room if you want to.Ã,  If this does not help, then I'll have to leave it to the experts to help you out.Ã, 

Good luck.
#3
Okay well I got the 9 inventory items on the screen working fine now, and I can right click and make the cursor change, however when I right click on one of the items in the Inventory Window, it still runs the "LOOK" code before changing the cursor.Ã,  I am posting my Global Script again from the very top down to where I think no more is required.Ã,  This is so I can enure everything is in the right order.Ã,  There is some extra code in the On_Mouse_click function, but this works fine, for where I need it.Ã, 

To help debug this, I have placed "Display" commands to see what executes before the "LOOK code is displayed.Ã,  I have highlighted these with theÃ,  8) smiley face, and it they execute in the order from top down when run.Ã,  I have placed theÃ,  ??? Smiley face where the "LOOK" code seems to execute, which I can't determine how, when no line seems to be executed to do this.Ã,  So in summary, the line "On_Event - Mouse Down End" is displayed, then the relevant "LOOK" code is executed, before the line "On_Event - Mouse Up Start" is executed.  If you need any other code let me know.

// main global script file
int TButton;

function game_start() {
Ã,  // called when the game starts, before the first room is loaded
Ã,  SetInvDimensions (64,64);
}

function repeatedly_execute() {
Ã,  // put anything you want to happen every game cycle here
}

function on_key_press(int keycode) {
Ã,  // called when a key is pressed. keycode holds the key's ASCII code
Ã,  if (IsGamePaused() == 1) keycode=0;Ã,  // game paused, so don't react to keypresses
Ã,  if (keycode==17)Ã,  QuitGame(1);Ã,  Ã, // Ctrl-Q
Ã,  if (keycode==363) SaveGameDialog();Ã,  Ã, // F5
Ã,  if (keycode==365) RestoreGameDialog();Ã,  // F7
Ã,  if (keycode==367) RestartGame();Ã,  // F9
Ã,  if (keycode==434) SaveScreenShot("scrnshot.bmp");Ã,  // F12
Ã,  if (keycode==9)Ã,  Ã, GUIOn(1);
      Ã,  Ã,  SetCursorMode(2);

Ã,  if (keycode==19)Ã,  Debug(0,0);Ã,  // Ctrl-S, give all inventory
Ã,  if (keycode==22)Ã,  Debug(1,0);Ã,  // Ctrl-V, version
Ã,  if (keycode==1)Ã,  Ã, Debug(2,0);Ã,  // Ctrl-A, show walkable areas
Ã,  if (keycode==24)Ã,  Debug(3,0);Ã,  // Ctrl-X, teleport to room
}

function on_mouse_click(int 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==LEFT)
   {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
   }
else
   {Ã,  Ã, // right-click, so cycle cursor
   if (GetGlobalInt(10)==1)
      {
      if (GetCursorMode() == 10)
         {
         SetCursorMode(1);
         }
      else if (GetCursorMode() == 3)
         {
         if (character[ GetPlayerCharacter() ].activeinv == -1)
            {
            SetCursorMode(10);
            }
         else
            {
            SetCursorMode(4);
            }
         }
      else if (GetCursorMode() == 4)
         {
         SetCursorMode(10);
         }
      else
         {
         SetNextCursorMode();
         }
      }
   else if (GetGlobalInt(8 ) == 1)
      {
      SetCursorMode (MODE_USE);
      SetMouseCursor (2);
      }
   else
      {
      SetNextCursorMode();
      }
   }
}

function Interface_Click(int interface, int button)
{
if (interface == ICONBAR)
   {
   if (button == 0)
      {
      if (GetGlobalInt(10)==1)
         {
         SetCursorMode(10);
         }
      else
         {
         SetCursorMode(0);
         }
      }
   if (button == 4)
      {
      // show inventory
      GUIOn(1);
      SetCursorMode(2);
      }
   else if (button == 5)
      {
      // use selected inventory
      if (character[ GetPlayerCharacter() ].activeinv >= 0)
         SetCursorMode(4);
      }
   else if (button == 6)
      // save game
      SaveGameDialog();
   else if (button == 7)
      // load game
      RestoreGameDialog();
   else if (button == 8 )
      // quit
      QuitGame(1);
   else if (button == 9)
      // about
      Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
   } // end if interface ICONBAR   
else if (interface == INVENTORY)
   {
   ifÃ,  (TButton==2)Ã,  // They clicked the right button on the Inventory GUI
      {
      if (GetCursorMode() == 1)
         {
         SetCursorMode(3);
         SetMouseCursor(2);
         }
      else if (GetCursorMode() == 3)
         {
         SetCursorMode(2);
         SetMouseCursor(6);
         }
      else if (GetCursorMode() == 2)
         {
         SetCursorMode(1);
         SetMouseCursor(1);
         }
      }
   elseÃ,  // They clicked the left button on the Inventory GUI
      {
      if (button == 0)
         {
         // USE Button
         SetCursorMode(1);
         SetMouseCursor(1);
         }
      if (button == 1)
         {
         // USE Button
         SetCursorMode(3);
         SetMouseCursor(2);
         }
      if (button == 2)
         {
         // TAKE Button
         SetCursorMode(2);
         SetMouseCursor(6);
         }
      if (button == 3)
         {
         // CLOSE Button
         GUIOff(1);
         SetDefaultCursor();
         }
      if (button == 4)
      {
         // UP Button
         if (game.top_inv_item > 0)
            {
            game.top_inv_item = game.top_inv_item - game.items_per_line;
            }
         }
      if (button == 5)
         {
         // DOWN Button
         if (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)
            {
            game.top_inv_item = game.top_inv_item + game.items_per_line;
            }
         }
      }
   }Ã,  // end if interface INVENTORY
}

int GUIButton;

function on_eventÃ,  (int event, int data)
{
   ifÃ,  (event==GUI_MDOWN)
      {
8)      Display("On_Event - Mouse Down Start");
      Ã, 
      RefreshMouse();
      if (IsButtonDown (RIGHT) ==1)
         {
         TButton=2;
         }
      else if (IsButtonDown (LEFT) ==1)
         {
         TButton=1;
         GUIButton=GetGUIObjectAt(mouse.x,mouse.y);
         }
8)      Display("On_Event - Mouse Down End");
      }
???
   ifÃ,  (event==GUI_MUP)
      {
8)      Display("On_Event - Mouse Up Start");
      Interface_Click (data,GUIButton);
8)      Display("On_Event - Mouse Up End");
      }
}
#4
Actually why I'm at it, just thought I'd ask my only other question.  I know in the manual says that these values are read only, but I would still like to know if I can set the below values to what I want them to be 

game.items_per_line            (I would like this to be 3, not 2)
game.num_inv_displayed     (I would like this to be 9, not 4)

This should then cover all my questions with GUI's.

Thanks.
#5
Thank will check it out.
#6
There is nothing in the repeatedly execute function.

function repeatedly_execute() {
  // put anything you want to happen every game cycle here
}

Thanks.
#7
Hi guys and gals, 

       It's been a while since I posted this, but I've spent a bit of time away from AGS but I'm finally back.  My question is kind of continuing along the lines of DORCAN's tutorial on creating your own GUI.  I have since created my own GUI, but it really bugs me when I want to cycle through the cursor modes (By right clicking) to the one I want, but it always just runs the "Loook" Script, no matter what current cursor mode is.  I started trying to work it out, and learnt that I can turn "Handle InventoryClicks In Script" on, and maybe use the value RIGHTINV through the on_mouse_click function, but not sure how to put it all together.  Can some one please provide an example of how the code should look for this to work.  I have attached my current code. 


function on_mouse_click(int 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==LEFT)
    {
    ProcessClick(mouse.x, mouse.y, GetCursorMode() );
    }
  //else if (button==RIGHTINV)
    //{
    //SetNextCursorMode();
    //}
  else
    {
    // right-click, so cycle cursor
    SetNextCursorMode();
    }   
  }



function interface_click(int interface, int button)
  {
  if (interface == 2)
    {
    // They clicked a button on the Inventory GUI
   
    if (button == 1)
      {
      // They pressed SELECT, so switch to the Get cursor
      SetCursorMode (3);
      SetMouseCursor (2);
      }

    if (button == 2)
      {
      // They pressed TAKE, so switch to that mode
      SetCursorMode(2);
      SetMouseCursor (6);
      }

    if (button == 3)
      {
      // They pressed the CLOSE button, close the GUI
      GUIOff (2);
      SetDefaultCursor();
      SetButtonPic(0,5,1,2049);
      }

    if  (button == 4)
      {
      //"Up" arrow
      if  (game.top_inv_item > 0)
        game.top_inv_item = game.top_inv_item - game.items_per_line;
      }

    if  (button == 5)
      {
      //"Down" arrow
      if  (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)
        game.top_inv_item = game.top_inv_item + game.items_per_line;
      }
  }
}

Thanks in advance, Eddie.
#8
Thanks for that, I'll download it now.   8)
#9
Thanks for that Scummbuddy, I'll keep that in mind.  I currently have version 2.6 SP1, and can't seem to find the beta version, unless it's not available for download.  I checked the download site and news sites of AGS, but no luck.  Where can I get a copy of this, or do we need to wait for 2.6 SP2 or so?
#10
I'll give it a shot.  Also thanks for those great Tutes, everything seems to make sense now, and the Adobe Photoshop Tutes are good too that I've reviewed so far. 8)
#11
Thanks for that SSH.  

    I changed the WALK button to run a script instead of use cursor mode WALK. (Out of interest can you modify the code behind this cursor mode, or can you create your own?  If so are there any Tuturials on this.)  I also tried your code for the right clicking issue, however once you right clicked until WALK (When the cursor changed accordingly), when attempting to right click again, it does not change, as it must always be switching the cursor mode back to the new Cursor Mode.   :P

    So in the end I modified the function "on_mouse_click", inparticular where the value of BUTTON was for the right button.  I used the below code which seemed to do the job fine.  I am curious to know though if the function "repeatedly_execute" could still be used to do this action if there is a way.  Maybe adding a pause in between the loop may allow the right click to be recognised, if you can pause the loop but still allow interactions.  Does using this function put a high load on the CPU or reduce performance of the game, just out of interest.  

   Any way thanks for your help, that sorted things out so I now have a fair knowledge on GUI's and how they work, now to dive into the second part to learn more.

function on_mouse_click(int 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==LEFT) {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else
   {   // right-click, so cycle cursor
   if (GetGlobalInt(10)==1)
      {
      // Replace CursorMode 0 with CursorMode 5
      if (GetCursorMode() == 5)
         {
         SetCursorMode(1);
         }
      else if (GetCursorMode() == 3)
         {
         // Check to see if an inventory item has been selected or not, to determine the next Cursor Mode
         if (character[ GetPlayerCharacter() ].activeinv == -1)
            {
            SetCursorMode(5);
            }
         else
            {
            SetCursorMode(4);
            }
         }
      else if (GetCursorMode() == 4)
         {
         SetCursorMode(5);
         }
      else
         {
         SetNextCursorMode();
         }
      }
   else
      {
      SetNextCursorMode();
      }
   }
}

Thanks again everyone , it means a lot to me.   :D
#12
Hello,

   Thanks for the notes so far, that Tutorial will be great.  Tonight however I have only been concentrating on the first question and I am still stuck.  I run the command mentioned as soon as the player enters the room, which changes the picture of the button, but the walk cursor still appears.  I am not sure if I need to modify the script for this button.  I have been experimenting with "SetCursorMode(5)", (Mode=PickUp, displays a cross which does not do anything if I click on it), but I don't know how to set the cursor to this mode when I click on the old WALK button.  

I have tried testing the below out, but for some reason my message does not display when I click on WALK, but it does if I click on INVENTORY, what am I missing, I can't see where it checks the button number before this function.   Am I on the right track here, or am I over looking a simpler soloution?  Below is some of the global script where I was trying to learn how the GUI works a little more and place in my messages.  Unfortunately I have not had much time over the last couple of days to follow this up further, but hopefully over the next couple of days I'll dive into learning about GUI's a lot more, but this is a great start.

// main global script file

function show_inventory_window () {
 // This demonstrates both types of inventory window - the first part is how to
 // show the built-in inventory window, the second part uses the custom one.
 // Un-comment one section or the other below.
 
 // ** DEFAULT INVENTORY WINDOW
 InventoryScreen();
/*  
 // ** CUSTOM INVENTORY WINDOW
 GUIOn (INVENTORY);  
 // switch to the Use cursor (to select items with)
 SetCursorMode (MODE_USE);
 // But, override the appearance to look like the arrow
 SetMouseCursor (6);
*/
}

function interface_click(int interface, int button) {
 Display("Button Clicked.");
 if (interface == ICONBAR) {

// **************** This is the start of th code I have added, but it never executes, except the first message if I click on INVENTORY instead of WALK ************

   Display("IconBar Button Clicked.");
   if (button == 1)
   {
   if (GetGlobalInt(10)==1)
      {
      Display("Change Cursor Mode To Number 5");
      SetCursorMode(5);
      Wait(160);
      }
   else
      {
      Display("Change Cursor Mode To Number 0");
      SetCursorMode(0);
      Wait(160);
      }
   }
   else if (button == 4) {  // show inventory

// ********* This is the end of the new/modified code ***************

     show_inventory_window();
   }
   else if (button == 5) {   // use selected inventory
     if (character[ GetPlayerCharacter() ].activeinv >= 0)
       SetCursorMode(4);
   }
   else if (button == 6)    // save game
     SaveGameDialog();
   else if (button == 7)   // load game
     RestoreGameDialog();
   else if (button == 8)   // quit
     QuitGame(1);
   else if (button == 9)    // about
     Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2003 Chris Jones");
 }  // end if interface ICONBAR


I will check this again, but are there any other tutorials around besides the one on the links page.  They are great, but only to get you going, and some are for the old DOS version which has talkes about things that no longer exist.  If not when I've spent some time learning this program a lot more and am becoming a lot more skilled maybe I'll write some to handle similar questions to what I had, which I thought were handy topics.  If they already exist, great, where can I find some?

Hopefully I'm not too much of a pain and thanks again for everything.  (This is my largest post ever!)
#13
I'll try that first part out, probably tomorrow.  I did visit the site listed for my second question, but unfortunately for me it is in a language I don't understand, but I'll check out the pictures and a few key words and see if I can make something out, a real challenge.  :)
#14
Hello,

   I haven't spent to much time learning about GUI's as yet, as I' hoping just to use the Standard GUI's for my first game.  However I want to be able to do a couple of things with them and I have spent the last hour reading and searching for the answers with no luck.  

 My situation is I have a room where a character can walk around in normally, but when he interacts with something, I want to be able to turn off the "Walk" GUI Object, but I can't find the right function to use, I can only find GUIOn and GUIOff, which is not want I want as that turns off the whole GUI and not just that Object.  Is there a simple way to do this?  

 My second question is a little more complicated, and I probably need to fiddle around a little more searching and learning how to do this.  I want to add an extra button to the standard "Inventory" GUI, which is like a Turn on (Or Interact) command, which will allow the player to simply click on the item (Say a torch) in the inventory gui to turn it on.  I was just wondering if there is any example code out there on how I need to code this action, and info on what else is required.  If someone could do this, that would be great, but for now my first question is my main priority.  

Thanks, Eddie.
SMF spam blocked by CleanTalk