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 - LeChuck

#121
I much prefer the new way. It makes it easier and faster to navigate.
#122
Silly me, since PlaySoundEx always mentions "channels", I assumed left/right stereo channel and quickly disregarded the feature. Thanks Ashen!
#123
I have a screen where a train passes by every now and then. Here's the repeatedly execute script:

Quote
if ((character[TRAIN].x > -100) && (character[TRAIN].x < 420)) { // If train is closing in on visible screen, play the train sound
PlaySound(4);
}

if (character[TRAIN].walking == 0) { // When the train has reached its destination, it's time to go back
Ã,  int randomPosX = Random(1000)-2000; // Find random negative X value
Ã,  MoveCharacterPath (TRAIN, randomPosX, 152);
Ã, 
Ã,  int randomNegX = Random(1000)+2000; // Find random positive X value
Ã,  MoveCharacterPath (TRAIN, randomNegX, 152);
Ã,  }

if (AreCharactersColliding(EGO, TRAIN)) { // Character being hit by train
Ã,  Display("Ouch!");
Ã,  }

if (AreCharObjColliding(TRAIN, 0)) { // Train hits bottle
Ã,  ObjectOff(0); // Bottle vanishes
Ã,  ObjectOn(1); // Insides revealed
   }

I have this puzzle where, in order to open a bottle, you have to put in on the train tracks and wait for the train to pass by. As the train is already making a sound when it's passing by, having the engine output a nice glass breaking sound proved harder than I imagined.

Putting a "PlaySound(X) while (IsSoundPlaying()) Wait(1);" in the AreCharObjColliding part won't work, since there is a sound playing continously from before (the train sound). A simple PlaySound(X) obviously won't work as it's in the rep execute script. I've tried experimenting with various Global Ints also, but haven't had any luck here.


In short, my questions are:

A) How do I workaround this problem?
B) How come the AGS engine can't find out whether a spesific sound effect is playing or not? Why not a IsSoundPlaying(X) function?
#124
That last piece of code certainly did the trick! Thank you! :)
#125
I can't believe I can't make this work... I am so angry I'm about to pop a fuse! In a rooms repeatedly execute:

Code: ags

if (i = 320) {
Ã,  SetCharacterView(JUBALON, 23);
Ã,  AnimateCharacter(JUBALON, 0, 3, 1);
Ã,  while (character[JUBALON].animating) Wait(1);
Ã,  ReleaseCharacterView(JUBALON);
Ã,  i = 0;
Ã,  }

i++;
}



My problem is where to define integers start value?

It's supposed to be an Idle animation, where a person is sipping soda from a bottle. When the animation is running, the bottle, Object 0, should vanish.

I've tried using the Idle animation thing, but that doesn't let me turn an object off, or does it? (Actually I tried playing an empty sound file during one frame of the animation to remove Object(0) (With the help of a bit of code in rep execute), but, since AGS can't distinguish one sound from another, it didn't work correctly. If a command like IsSoundPlaying(8) would be available, it would save a lot of trouble.

Or, perhaps there is a command that reports back if a spesific View is being used? If the program could report back if my character is using view 23 I'd sure appreciate someone telling it to me.Ã,  :-X
#126
Here's how I solved it:

Defined in main global script file:
int textId;

When looking at an item, run this script:
textId = CreateTextOverlay(int x, int y, int width, int font, int colour, string text);
SetGlobalInt(24, 1); //Choose a free global integer here.

In repeatedly execute:
if (GetGlobalInt(24)==1) {WaitMouseKey(100); RemoveOverlay(textId); SetGlobalInt(24, 0);}


It looks and acts just like normal text. It won't show on top of your GUI, but you do have the possibility to control where to show the text. I chose to view it right under the inventory GUI.
#127
I don't understand how I could've had so much trouble getting a simple command like the SetGUIClickable working correctly. It's almost embarrasing. Consider it SOLVED.  ::)
#128
Funny that two of you should mention the Popup Modal thing, as it doesn't change anything. I can still click the GUIs underneath them. As for Radiants suggestion, I still can't find anything of use in the manual that's helpful...
#129
I tried the SetGUIEnabled thing, but the script manager won't recognize it... Are you sure you wrote it correctly?

Edit: I've looked through the manual, but couldn't find anything I could use... Unless I've overlooked something?
#130
When I press the F5 button, a custom GUI pops up. The problem is, I can still press and interact with persons and objects in the game world when clicking outside this GUI. How do I make a GUI stay on top blocking all other GUIs? ???

The same problem goes for when another GUI pops up:



I can still click the buttons on the GUI "below" it!  >:(
#131
According to the manual:

Quote
PlayVideo

PlayVideo (string filename, int skip, int flags)

Plays an AVI or MPG file, or any other file type supported by Media Player.

FLAGS can be one of the following:

0: the video will be played at original size, with AVI audio

1: the video will be stretched to full screen, with appropriate

black borders to maintain its aspect ratio and AVI audio.

10: original size, with game audio continuing (AVI audio muted)

11: stretched to full screen, with game audio continuing (AVI audio muted)

SKIP defines how the player can skip the video:

0 player can't skip video

1 player can press ESC to skip video

2 player can press any key to skip animation

The game is paused while the animation plays.


You'd probably want PlayVideo("filename.avi", 1, 0);
#132
Perhaps I can squeeze another helpful answer out of you guys without creating a new thread?

Everything's working fine and dandy now, with an interface pretty much spot on like the one in Sam & Max in terms of functionality. There's just one catch: Whenever I right-click on the tiny inventory shortcut icon in the bottom right corner, in addition to cycling the mouse cursors like it's supposed to, it also opens the inventory window. I have not been able to stop this behaviour (not opening inv. window), after countless tries implementing the IsButtonDown(RIGHT) pretty much all over the place where I found it appropriate. In this case, it cycles the icons just fine when clicking the right mouse button over the GUI, but does not react when I left click / try to open it.

Here are the parts I suspect has to be changed:

Code: ags


function interface_click(int interface, int button) {

Ã,  if (interface == LUGGAGE) { //LUGGAGE is the GUIObject that opens the inventory
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã, if ((button == 0) && (GetCursorMode()!=4)) {Ã,  // cursor is NOT useinv
Ã,  Ã,  Ã,  Ã,  Ã, SetCursorMode(MODE_LOOK);
Ã,  Ã,  Ã,  Ã,  Ã, GUIOn(INVENTORY);
Ã,  Ã,  Ã,  Ã,  Ã, GUIOff(LUGGAGE);
Ã,  Ã,  Ã, }
Ã,  Ã, 
Ã,  Ã,  Ã, else if ((button == 0) && (GetCursorMode()==4)) {Ã,  // cursor IS useinv
Ã,  Ã,  Ã,  Ã,  if (character[SELF].activeinv==3) {
Ã,  Ã,  Ã,  Ã,  SetInvItemPic(3, 31);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  if (character[SELF].activeinv==4) {
Ã,  Ã,  Ã,  Ã,  SetInvItemPic(4, 32);
Ã,  Ã,  Ã,  Ã,  }
 
Ã,  Ã,  Ã,  Ã,  SetActiveInventory (-1);
Ã,  Ã,  Ã,  Ã,  SetCursorMode(MODE_WALK);
Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã, }
Ã,  }Ã,  // end if interface LUGGAGE

This is the part where I've tried the most, using IsButtonDown, but alas, no cigars were handed out.

Oh no, not this part again! :(
Code: ags

function on_mouse_click(int button) {

int oldItemGraphic; // used for loading the old sprite back when item is deactivated
int currentItem;

Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
Ã,  if (button==LEFT) {
Ã,  Ã,  if (IsGUIOn(INVENTORY)) {
Ã,  Ã,  // Do nothing
Ã,  Ã,  }
Ã,  Ã,  else {
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã,  Ã,  }
Ã,  }


Ã,  else if (button == LEFTINV) { // if left-clicked on an inventory item
Ã,  
Ã,  Ã, if (GetCursorMode()==1) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã, else if (GetCursorMode()==2) {
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  // Commands for removing item from inventory / loading new cursor sprite
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  SetActiveInventory(game.inv_activated); // activates the clicked item
Ã,  Ã,  Ã,  currentItem = character[GetPlayerCharacter()].activeinv; // stores the current item number
Ã,  Ã,  Ã,  oldItemGraphic = GetInvGraphic(currentItem); // stores items graphic slot, used for loading later
Ã,  Ã,  Ã,  SetInvItemPic(game.inv_activated, 0); // removes the sprite from inventory
Ã,  Ã,  Ã,  if (character[SELF].activeinv==3) {
Ã,  Ã,  Ã,  Ã,  Ã, SetMouseCursor(13); // loads the new cursor
Ã,  Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  
Ã,  Ã,  Ã,  else if (character[SELF].activeinv==4) {
Ã,  Ã,  Ã,  Ã,  Ã, SetMouseCursor(14); // loads the new cursor
Ã,  Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  }

Ã,  Ã,  else if (GetCursorMode()==3) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã,  else if (GetCursorMode()==4) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã,  Ã,  Ã,  Ã, }
Ã,  }



Ã,  else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã,  Ã,  // Do nothing
Ã,  }


Ã,  else if (button == RIGHT) {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  Ã,  Ã,  SetNextCursorMode();
Ã,  }
}


The whole global script: global2.txt
The game so far, really just an interface test: Frankenstein.exe


In conclusion, I could need some help in making the game IGNORE right-clicks on an interface, but without interfering with the cursor cycle. What's the way to do this?
#133
Now it works! I really, really appreciate you've helped me strazer, I really do. The problem probably wasn't in the on_mouse_click script, it was in the repeatedly execute script, where I changed this:

Code: ags

//MOUSE CURSOR
string name;
GetLocationName(mouse.x, mouse.y, name);// Get the name of what's under the cursor
if (StrComp(name,"")==0) SetDefaultCursor();// if blank ( or hotspot with no name ) do nothing
else {
Ã,  Ã, if (GetCursorMode()==1) {
Ã,  Ã,  Ã,  if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8);
Ã,  Ã, else SetDefaultCursor(); 
Ã,  Ã, }
Ã,  Ã, if (GetCursorMode()==2) {
Ã,  Ã,  Ã,  if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(9); 
Ã,  Ã, else SetDefaultCursor(); 
Ã,  Ã, }
Ã,  Ã, if (GetCursorMode()==3) {
Ã,  Ã,  Ã,  if (GetLocationType(mouse.x,mouse.y)==2) SetMouseCursor(10);
Ã,  Ã, else SetDefaultCursor(); 
Ã,  Ã, }
}


... into this:

Code: ags

string name;
GetLocationName(mouse.x, mouse.y, name);	// Get the name of what's under the cursor	
if (StrComp(name,"")==0) { // Nothing underneath
Ã,  if (GetCursorMode()==4) { // Nothing underneath, so show custom cursor
Ã,  Ã,  Ã,  if (character[SELF].activeinv==3) {
Ã,  Ã,  Ã,  Ã,  Ã, SetMouseCursor(13);
Ã,  Ã,  Ã, }
Ã,  Ã, }
Ã,  else {
Ã,  SetDefaultCursor();
Ã,  }
}

else { // object underneath
Ã,  Ã,  Ã,  if (GetCursorMode()==1) {
Ã,  Ã,  Ã,  Ã,  Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8);
Ã,  Ã,  Ã,  else SetDefaultCursor(); 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (GetCursorMode()==2) {
Ã,  Ã,  Ã,  Ã,  Ã, if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(9); 
Ã,  Ã,  Ã,  else SetDefaultCursor(); 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (GetCursorMode()==3) {
Ã,  Ã,  Ã,  Ã,  Ã, if (GetLocationType(mouse.x,mouse.y)==2) SetMouseCursor(10);
Ã,  Ã,  Ã,  else SetDefaultCursor(); 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else if (GetCursorMode()==4) { 
Ã,  Ã,  Ã,  Ã,  Ã, if (character[SELF].activeinv==3) {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã, SetMouseCursor(11);
Ã,  Ã,  Ã, }
Ã,  Ã, }
}


The problem was in summary that the code in repeatedly execute was overriding the on_mouse_click script, setting it back to DefaultCursor every time the mouse wasn't hovering over something.


Who would've thought cursors changing when hovering over objects, custom GUI's, cycling the active inventory and implementing a "remove item from inventory" illusion (instead of "duplicating item") would be such a pain in the ass combined???Ã, 

I hope others can find my shoddy code useful, and thanks again to strazer. I'VE certainly learned something! I would've used parts of your code, but that's how it was when I got it working, the fear of vomiting all over my keyboard keeps me from changing it. ;)

Edit: Hm, it just occured to me maybe this doesn't belong in "Beginners Technical Quesions"... ?
#134
I tried that too, it does nothing.

There must be some major flaw in the code, or AGS doesn't like changing the active inventory cursor. I tried breaking the code up into two parts:

Code: ags

Ã,  else if ((button == RIGHT) && (GetCursorMode()==3) && (currentItem > 0)) {Ã,  Ã, // If right mouse button is down, cursorMode is 3 and an inventory item is active
Ã,  Ã,  Ã,  Ã,  Ã,  SetNextCursorMode();
Ã,  Ã,  Ã,  Ã,  Ã,  ChangeCursorGraphic(4, oldItemGraphic);
Ã,  }
Ã,  

Ã,  else if ((button == RIGHT) && (currentItem==0)) {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  Ã,  Ã,  SetNextCursorMode();
Ã,  }


The active inventory still remains transparent.

Damn, when did you say 2.7 was due? I am a millimetre away from giving up here...

#135
Crap, that didn't work either, I still get an empty sprite when cycling. Funny thing is, I can make the talk cursor change appearance this way, but not the active intentory item.

Has this never been done before? Aren't there any examples on how to do this? I haven't been able to find any.
#136
Quote from: Guest on Sat 05/02/2005 23:30:03
???PLz simplify ???

It would be alot simpler if you actually asked a question... If you have a bare minimum of programming knowledge, you should know what the if / else stuff does.

GetGlobalInt and SetGlobalInt, this is probably the part you don't understand... In AGS you have what's called global variables, and by default all these variables are set to 0. You can use whichever one of these you want anywhere in your code. In my example it uses the global variable 1, which by default has the value 0. A global variable can only have the values 0 or 1 - think of it as off and on.

Code: ags

Ã,  Ã, if (GetGlobalInt(1)==0) { // This part checks if the action has been executed before. If global variable 1 has the value 0, do this.
Ã,  Ã,  Ã,  // Add code for first interaction
Ã,  Ã,  Ã,  SetGlobalInt(1, 1); // This part tells the script that the first interaction has happened, hence we change global variable 1's value to 1.
Ã,  Ã,  Ã,  }
Ã,  Ã, else { // This part is what is run if the first interaction has happened, ergo global variable 1 HAS been changed to 1.
Ã,  Ã,  Ã, // Add code for second interaction
Ã,  Ã, }


I tried explaining it closer in the code above. Of course, if you prefer not to script, you can do what Ashen suggested.
#137
I do it like this:


   if (GetGlobalInt(1)==0) {
      // Add code for first interaction
      SetGlobalInt(1, 1);
      }
   else {
     // Add code for second interaction
   }
#138
I've tried some more, but really can't make it work:

Code: ags


#sectionstart on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE

 function on_mouse_click(int button) {
Ã,  
 int currentItem; // used to store the current item
 int oldItemGraphic; // used for loading the old sprite back when item is deactivated
 
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
Ã,  if (button==LEFT) {
Ã,  Ã,  if (IsGUIOn(INVENTORY)) {
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  // Add command for removing item from hand, adding it back into the inventory

Ã,  Ã,  }Ã,  Ã,  
Ã,  Ã,  else {
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã,  Ã,  }
Ã,  }




Ã,  else if (button == LEFTINV) { // if left-clicked on an inventory item
Ã,  
Ã,  Ã, if (GetCursorMode()==1) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã, else if (GetCursorMode()==2) {
Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  // Commands for removing item from inventory / loading new cursor sprite
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  SetActiveInventory(game.inv_activated); // activates the clicked item
Ã,  Ã,  Ã,  currentItem = character[GetPlayerCharacter()].activeinv; // stores the current item number
Ã,  Ã,  Ã,  oldItemGraphic = GetInvGraphic(currentItem); // stores items graphic slot, used for loading later
Ã,  Ã,  Ã,  SetInvItemPic(game.inv_activated, 0); // removes the sprite from inventory
Ã,  Ã,  Ã,  ChangeCursorGraphic(currentItem, 31); // loads the new cursor
Ã,  Ã,  Ã,  }
 
 
Ã,  Ã,  else if (GetCursorMode()==3) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã,  else if (GetCursorMode()==4) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã,  Ã,  Ã,  Ã, }
Ã,  }




Ã,  else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã,  Ã,  // Do nothing
Ã,  }



Ã,  else if (button == RIGHT) {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  Ã, if (currentItem > 0) {Ã,  Ã,  // if an item is active
Ã,  Ã,  Ã,  Ã,  if (GetCursorMode()==3) { // if the next cursorMode is the active inventory item
Ã,  Ã,  Ã,  Ã,  Ã,  SetNextCursorMode();
Ã,  Ã,  Ã,  Ã,  Ã,  ChangeCursorGraphic(currentItem, 31);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã, }
Ã,  Ã, 
Ã,  Ã,  Ã, else if (currentItem == 0) { // if NO item is active
Ã,  Ã,  Ã,  Ã,  SetNextCursorMode();
Ã,  Ã,  Ã, }
Ã,  }
}


The problem is still that it won't load the sprite when cycling...
#139
Quote from: strazer on Sat 05/02/2005 05:12:20
1.) DisableCursorMode

2.) You could set the item to a blank sprite with SetInvItemPic while it's activated.

With AGS v2.7 you will be able to add an item to a specified position in the inventory so you could store its position, remove it from the inventory and add it back to the old position once the user changes the cursor mode.

I've noticed you don't use "else" much:

Ã,  if (GetCursorMode()==0) {
Ã,  Ã,  SetCursorMode(1);
Ã,  }
Ã,  // use "else, otherwise the following will also be executed if cursor mode is 0 because you set the cursor mode to 1 in the part above:
Ã,  else if (GetCursorMode()==1) {
Ã,  Ã,  SetMouseCursor(8 );
Ã,  }


1. Ah, excellent! :D

2. Alright, I've tried for almost four hours now, but I cannot for the life of me make it work.

Code: ags

Ã,  if (button==LEFT) {
Ã,  Ã,  Ã,  if (GetCursorMode()==2) { // The use command
Ã, 
Ã,  Ã,  Ã,  // Commands for removing item from inventory
Ã,  Ã,  Ã,  SetInvItemPic(game.inv_activated, 0); // O is a transparent sprite
Ã,  Ã,  Ã,  SetActiveInventory(game.inv_activated); // Activates the item
Ã,  Ã,  Ã,  currentItem = character[GetPlayerCharacter()].activeinv; // Stores the item number in the currentItem variable... not that it does much good here
Ã,  Ã,  Ã,  ChangeCursorGraphic(4, 31); // Changes the cursors appearance, since SetInvItemPic makes it transparent... :(
Ã,  Ã,  Ã,  }
}


The main problem here is that SetInvItemPic doesn't just change the inventory icon, but also the cursor mode. I've tried solving this by changing the cursors appearance as you can see in the code above, but this leads to a new problem; when circulating the icons, upon the items next showing, it is again the transparent texture - NOT the new cursor I want it to have.


About the else-thing: You're absolutely right...Ã,  :-\
#140
Alright, things are starting to shape up thanks to strazer! However, I've still got a few issues with the inventory interface ...


Here's the on_mouse_click code:
Code: ags

 function on_mouse_click(int button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
Ã,  
Ã,  if (button==LEFT) {
Ã,  Ã,  if (IsGUIOn(INVENTORY)) {
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  // Add command for removing item from hand.
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  }
Ã,  Ã,  else {
Ã,  Ã,  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
Ã,  Ã,  }
Ã,  }

Ã,  if (button == LEFTINV) { // if left-clicked on an inventory item

Ã,  Ã, if (GetCursorMode()==1) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_LOOK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã, if (GetCursorMode()==2) {
Ã,  Ã,  Ã,  SetActiveInventory(game.inv_activated);
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  // Add command for removing item from inventory.
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  }
 
Ã,  Ã,  if (GetCursorMode()==3) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_TALK);
Ã,  Ã,  Ã,  Ã, }

Ã,  Ã,  if (GetCursorMode()==4) {
Ã,  Ã,  Ã,  Ã, RunInventoryInteraction(game.inv_activated, MODE_USEINV);
Ã,  Ã,  Ã,  Ã, }
Ã,  }

Ã,  else if (button == RIGHTINV) { // if right-clicked on an inventory item
Ã,  Ã,  // Do nothing
Ã,  }

Ã,  else if (button == RIGHT) {Ã,  Ã, // right-click, so cycle cursor
Ã,  Ã,  SetNextCursorMode();
Ã,  }
}


It now allows right-clicking inside the interface, changing cursors there as in the game itself. Cool!


1. Cursor

This bit is in the repeatedly execute part of the global script:

Code: ags

if (IsGUIOn(INVENTORY)) { 

Ã,  Ã, if (GetCursorMode()==0) {// Changes the walk cursor to the Use cursor. 
Ã,  Ã,  Ã,  Ã, SetCursorMode(1);Ã,  Ã,  Ã,  Ã,  // This code doesn't work properly, 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, //and has to be changed
Ã,  Ã, }
Ã,  Ã, if (GetCursorMode()==1) { // Changes the appearance of the Use cursor to an open eye instead of a closed one
Ã,  Ã,  Ã,  Ã, SetMouseCursor(8);
Ã,  Ã, }
Ã,  Ã, if (GetCursorMode()==2) { // Similar as above
Ã,  Ã,  Ã,  Ã, SetMouseCursor(9);
Ã,  Ã, }
Ã,  Ã, if (GetCursorMode()==3) { // Similar as above
Ã,  Ã,  Ã,  Ã, SetMouseCursor(10);
Ã,  Ã, }
}


The thing is, it keeps showing the walk cursor (cursor mode 0) inside the inventory window, which it really isn't supposed to do. I've tried to do a if (GetCursorMode()==0){SetCursorMode(1);}, but it still shows the walk cursor for a brief moment, making it look ... well, stupid.

Is there a way of simply disabling some cursors in certain situations, instead of skipping over them as I've tried?


2. Making the item disappear from Inventory when it's activated

We've all seen it in Lucasarts games; you active an inventory item, it becomes the mouse cursor, and disappears from the inventory GUI, giving the illusion of "lifting" it out of the inventory. In AGS, however, you "duplicate" the inventory item. Is there a workaround here?

If you look at the code part at the top, you'll see where I've planned to implement this kind of behaviour, if possible, as a start. Any tips or examples in this situation?

My guess here is that I have to use that other kind of Inventory system, where it indexes the position of the item, and moving the item out of sight (without the possibility of scrolling down to it) whenever the item is selected with the cursor?

SMF spam blocked by CleanTalk