MODULE: Control Modes (BASS, SCUMM, Sierra All in One module)

Started by Dualnames, Fri 04/09/2009 08:23:31

Previous topic - Next topic

Dualnames

Well, here have this(you can set any possible interface and combinations of them with this module).

Abstract:
You can set BASS,


SCUMM



or Sierra interface



to your game, fast and easy with this module. You can even have combinations of those three. Example: Have BASS interface and Sierra like GUI.


Downloads
Control Modes V1.0a
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Rex Mundane

Trying to use the BASS module I ran into a problem with scrolling rooms, where I couldnt walk further to the right than the screenwidth coordinate. Ended up replacing "player.Walk(mouse.x, mouse.y, eNoBlock, eWalkableAreas);" with "ProcessClick(mouse.x,mouse.y,eModeWalkto);" and that fixed it. Just thought you should now if you wanted to update the module.
My Blog: Ludo, ergo sum

Dualnames

Quote from: magma42 on Wed 20/01/2010 22:37:56
Trying to use the BASS module I ran into a problem with scrolling rooms, where I couldnt walk further to the right than the screenwidth coordinate. Ended up replacing "player.Walk(mouse.x, mouse.y, eNoBlock, eWalkableAreas);" with "ProcessClick(mouse.x,mouse.y,eModeWalkto);" and that fixed it. Just thought you should now if you wanted to update the module.

Someone is using this module! Great I'll update it. Btw is 42 just a random number or ... you know..

Quote
bicilotti: Never say numbers near 42 in Dual's presence.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)


Dualnames

First import the module.
Then you need is to find your mouse_on_click section in the globalscript script (not the header) and place only this (it should look like this, and there shouldn't be another on_mouse_click on the globalscript except for this)


Code: ags

function on_mouse_click(MouseButton *button) {
BASSFunctions.mouse_click(button,false);//exception on BASS: if you want left and right click reversed set reverse as true.
}


NOTE: BASS should have HandleInventoryScripts as false in the General Settings

I haven't played the dig, so I don't recall its interface. If it's similar to BASS somehow and someone might explain it to me, I'd be happy to implement it.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Sslaxx

Quote from: Dualnames on Thu 28/10/2010 11:51:03NOTE: BASS should have HandleInventoryScripts as false in the General Settings

I assume you mean "Override built-in inventory window click handling" by that, Dual?

I'm running into a problem with the module. I suspect it's me not understanding how this works properly, so help would be appreciated. AGS version 3.2.0 by the way. Using BASS mode with the buttons reversed.

http://sslaxx.twu.net/Tester.7z - this is what I'm doing.

So, the game's set to change the pointer to eModeInteract on entering room 1. Fine, seems to work so far. Go to inventory, select the blue mug, click on OK, then click on the player. The cursor changes to eWalkTo, and then the inventory item(s) seem to become unselectable.

Help?
Stuart "Sslaxx" Moore.

Khris

Insert this at line 97 of ControlModes.asc:

Code: ags
      mouse.Mode = eModeInteract;


What happened is that upon de-selecting the inventory item, AGS moved to the next default cursor mode, in this case eModeWalk. Since you can't change the mode (as e.g. by right-clicking in the default game), you're stuck.

The problem is that you're using the reverse button order, i.e. if an inventory item is selected, you are supposed to right-click to use it and left-click to loose it (really unintuitive I'd say; I'd stick with a left click to interact/use items and a right click to examine/deselect the active inv). You left clicked to use the cup on Roger and actually de-selected the cup.

It's also worth noting that the module always calls the TalkTo event for characters, not the Interact event (I saw the interact roger test event).

---

Another way to deal with this problem is disabling eModeWalk.

Sslaxx

Quote from: Khris on Tue 16/11/2010 16:38:22
Insert this at line 97 of ControlModes.asc:

Code: ags
      mouse.Mode = eModeInteract;


What happened is that upon de-selecting the inventory item, AGS moved to the next default cursor mode, in this case eModeWalk. Since you can't change the mode (as e.g. by right-clicking in the default game), you're stuck.

The problem is that you're using the reverse button order, i.e. if an inventory item is selected, you are supposed to right-click to use it and left-click to loose it (really unintuitive I'd say; I'd stick with a left click to interact/use items and a right click to examine/deselect the active inv). You left clicked to use the cup on Roger and actually de-selected the cup.

It's also worth noting that the module always calls the TalkTo event for characters, not the Interact event (I saw the interact roger test event).
Thanks for that, Khris! I shall bear that in mind. And that change works nicely!
Stuart "Sslaxx" Moore.

Sslaxx

Dumb question time - how do you go about coding an object's interaction with another object to work with the left mouse button?

OK:

Code: ags
 if ((reverse==false) && (click==eMouseLeft)|| (reverse==true) && (click==eMouseRight))
 {
  if (player.ActiveInventory!=null)
  {
   ProcessClick(mouse.x, mouse.y, eModeUseinv);  
   return;
  }
  ProcessClick(mouse.x, mouse.y, eModeLookat);  
 }


So swapping the eMouseLeft and eMouseRight conditions should work as I want, so let's give it a go... and no, it doesn't appear to work. I'm not entirely sure why, any ideas anyone?
Stuart "Sslaxx" Moore.

Dualnames

Quote from: Sslaxx on Wed 17/11/2010 22:31:19
Dumb question time - how do you go about coding an object's interaction with another object to work with the left mouse button?

OK:

Code: ags
 if ((reverse==false) && (click==eMouseLeft)|| (reverse==true) && (click==eMouseRight))
 {
  if (player.ActiveInventory!=null)
  {
   ProcessClick(mouse.x, mouse.y, eModeUseinv);  
   return;
  }
  ProcessClick(mouse.x, mouse.y, eModeLookat);  
 }


So swapping the eMouseLeft and eMouseRight conditions should work as I want, so let's give it a go... and no, it doesn't appear to work. I'm not entirely sure why, any ideas anyone?

This is the module's internal code. Can I have your code?

I'd like to rule that out now. First I haven't touched that module for like ages, and I did a small fix. I'm using it for hourgames, and never had a problem with that, but that doesn't mean jack shit. So well, what I'm trying to say, is that I barely recall it anymore, but I recall after some tests that everything worked fine.

I also have no idea, what is it you want to do.
This code is run with either the left or right mouse button. If you want this to run with the left mouse button that means you need to set reverse to false.
If you have an item, you'll get the useinv interaction instead.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Sslaxx

Quote from: Dualnames on Wed 17/11/2010 23:57:20This is the module's internal code. Can I have your code?

I'd like to rule that out now. First I haven't touched that module for like ages, and I did a small fix. I'm using it for hourgames, and never had a problem with that, but that doesn't mean jack shit. So well, what I'm trying to say, is that I barely recall it anymore, but I recall after some tests that everything worked fine.

I also have no idea, what is it you want to do.
This code is run with either the left or right mouse button. If you want this to run with the left mouse button that means you need to set reverse to false.
If you have an item, you'll get the useinv interaction instead.
What do I want to do? As it stands, with the module, if I want to use an inventory item on another item I have to right-click on it - even though I've told the module to use the reversed BASS-type control system and would, therefore, expect left clicking to work (as left clicking == interacting).

http://sslaxx.twu.net/ControlModesTest.7z is the code if you want to take a closer look (AGS 3.2.0). Note I made the change to your code that Khris suggested.
Stuart "Sslaxx" Moore.

Dualnames

There fixed. That who the function inside the module should be. So replace. I've included the whole function. Also override built-in inventory window click handling on General Settings should be set to true.

QuoteHowever, if you enable this option, then clicking on an inventory item in an Inventory Window will call your on_mouse_click function with eMouseLeftInv, eMouseMiddleInv or eMouseRightInv

That means because you had it the false, the code wasn't even being runned as i checked. But regardless it needed a fix.

Code: ags

static function BASSFunctions::mouse_click(MouseButton click, bool reverse){
 //handle true
 Hotspot*htsp=Hotspot.GetAtScreenXY(mouse.x, mouse.y);
 InventoryItem*invitem=InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
 if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y) != null) {
  if ((reverse==false) && (click==eMouseLeftInv) || (reverse==true) && (click==eMouseRightInv)){
   invitem.RunInteraction (eModeLookat);
  }
  if ((reverse==false) && (click==eMouseRightInv) || (reverse==true) && (click==eMouseLeftInv)){
  if (player.ActiveInventory!=null) {
  invitem.RunInteraction(eModeUseinv);
  }
  mouse.Mode=eModeUseinv;
   player.ActiveInventory=invitem;
  }
  return;
 }
 if ((reverse==false) && (click==eMouseRight)|| (reverse==true) && (click==eMouseLeft)) {
  if (player.ActiveInventory != null)  {
   ProcessClick(mouse.x, mouse.y, eModeUseinv);  
   return;
  }
  if (Character.GetAtScreenXY(mouse.x, mouse.y) != null)  {
   ProcessClick(mouse.x,mouse.y,eModeTalkto);  
   return;
  }
  if ((htsp!=null) && (htsp.ID>0) || (Object.GetAtScreenXY(mouse.x, mouse.y)!=null))  {
   ProcessClick(mouse.x,mouse.y,eModeInteract);  
   return;
  }
  ProcessClick(mouse.x,mouse.y,eModeWalkto);
 }
 if ((reverse==false) && (click==eMouseLeft) || (reverse==true) && (click==eMouseRight)) {
  if (player.ActiveInventory != null)  {
   player.ActiveInventory=null;
   mouse.Mode = eModeInteract;
   return;
  }  
ProcessClick(mouse.x, mouse.y, eModeLookat);  
 }
}

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Sslaxx

Quote from: Dualnames on Thu 18/11/2010 00:47:23
There fixed. That who the function inside the module should be. So replace. I've included the whole function. Also override built-in inventory window click handling on General Settings should be set to true.

QuoteHowever, if you enable this option, then clicking on an inventory item in an Inventory Window will call your on_mouse_click function with eMouseLeftInv, eMouseMiddleInv or eMouseRightInv

That means because you had it the false, the code wasn't even being runned as i checked. But regardless it needed a fix.

Quote from: Dualnames on Thu 28/10/2010 11:51:03NOTE: BASS should have HandleInventoryScripts as false in the General Settings
You said this earlier. But this refers to the same setting.

More pertinently, this still does not address the issue I've raised about interactions with inventory objects being inconsistent using the reversed BASS control system. To summarise:
* Left click to interact/talk to/walk to, right click to examine (with the reversed BASS control system).
* Logically, interacting with a hotspot with an inventory object should therefore use the left mouse button, yes?
* But it does not. It uses the right mouse button (examine) instead. This is not intuitive regarding the buttons functions.
Stuart "Sslaxx" Moore.

Dualnames

Oh, sorry man, Xenogia also contacted me about this like 2 months ago, and I set up the module to his needs. Okay, see the code above your post. I've edited, so replace. It should work just fine now.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

RoliX

Hello!

I would like to use reversed BASS control. Everything are fine... .... except with the inventory :/
Right click(examine) is okay, but left click(interact) is not. When I interact with an item on my inventory, the cursor totally disappears. I set to "true" the "Override built-in inventory window click handling" in the general settings. The problem still here, the cursor disappears when I click on an item in my inventory :(

Anyway, I use AGS 3.2, and my game is very simple. I just use a default game to test this module.

Sslaxx

Try replacing ControlModes.asc and ControlModes.ash with the files from http://sslaxx.twu.net/ControlModes.zip and see what happens, RoliX.
Stuart "Sslaxx" Moore.

RoliX

Quote from: Sslaxx on Wed 02/03/2011 19:52:51
Try replacing ControlModes.asc and ControlModes.ash with the files from http://sslaxx.twu.net/ControlModes.zip and see what happens, RoliX.

I replaced them with your files, but it still doesn't work :/  I have totally no clue about the issue..
Here is my source files if you're interested: http://www.sendspace.com/file/qv9rj5

Dualnames

RoliX, doesn't this http://www.adventuregamestudio.co.uk/yabb/index.php?topic=38762.msg559900#msg559900 , solve your problem?

EDIT: I just saw your source files.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

RoliX

I've already tried that, but still doesn't work properly. I spent hours to fix that, but not much success... I can't see what's the problem, I'm beginner in scripting :/

Dualnames

Quote from: RoliX on Thu 03/03/2011 09:12:06
I've already tried that, but still doesn't work properly. I spent hours to fix that, but not much success... I can't see what's the problem, I'm beginner in scripting :/

Okay, it appears there's no problem. When you left click on an item, it changes the item to that cursor's image. Now, if that's not what you want let me know, but anyhow. So since that item (the blue cup) has no cursor image assigned to it. It makes the mouse cursor completely invisible. All you need to do therefore is set an image.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk