Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: hedgefield on Mon 12/09/2011 16:54:49

Title: [MODULE] SingleCursor 1.1
Post by: hedgefield on Mon 12/09/2011 16:54:49
Since I can't seem to post in the Modules board anymore, here goes:

Following this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=44400) there seemed to be a demand for an updated single-cursor / two-click interface, also known as Broken Sword / BASS controls, and since I've scripted several permutations of it for my own projects I thought I'd compile it all into an easy-to-use module for you guys.

With LMB you perform the WalkTo/Interact/Talk action, and with RMB the LookAt action. There is also an optional extention for when you have a custom inventory, which puts select/combine on your LMB and deselect/examine on your RMB. If you want you can also swap this configuration around.

Download (http://timhengeveld.com/files/SingleCursor.scm)

After you import the module, follow these three steps to get everything working:

1. Remove the entire on_mouse_click function from your Globalscript.asc (or at least any code related to walk/talk/interact/look if you have other stuff in there).
2. Make sure you have one GUI with an inv window called InventoryWindow1 AND at least one inventory item or the whole thing will not work.
3. Use the bool SC_SwapLeftRight = true/false and the function CustomInv(true/false) in your game_start function to modify the controls.

The custom inventory thing could use some more testing, so let me know how it works for you or if you have any requests for additional configurations.
Title: Re: [MODULE] SingleCursor 1.0
Post by: DangerDinosaur on Mon 12/09/2011 19:46:29
Hi,

Thank you for doing this - really appreciated - but the link's not working for me. It just takes me to your site with a lot of broken images. Would it be possible to host it somewhere else?

Thanks again.
Title: Re: [MODULE] SingleCursor 1.0
Post by: hedgefield on Mon 12/09/2011 19:51:06
Oh woops sorry, put it in the wrong directory. Fixed.
Title: Re: [MODULE] SingleCursor 1.0
Post by: Kweepa on Tue 13/09/2011 00:14:57
Quote from: hedgefield on Mon 12/09/2011 16:54:49
Since I can't seem to post in the Modules board anymore, here goes:

Only moderators can. Your topic will be moved to Modules etc when deemed worthy :=
Title: Re: [MODULE] SingleCursor 1.0
Post by: hedgefield on Tue 13/09/2011 00:35:01
Hm, I was semi-convinced I had posted there before. I guess those must have been inceptions. :)
Title: Re: [MODULE] SingleCursor 1.0
Post by: Grim on Thu 15/09/2011 14:04:42
I'm struggling with setting up a working inventory... How about going one step further and adding a fully functional inventory?... Pretty pretty please?... ;)
Title: Re: [MODULE] SingleCursor 1.0
Post by: hedgefield on Thu 15/09/2011 15:15:28
Ha well I could, but that might complicate things. Then you get the matter of resolutionsss, and inventory styles and functions are often a matter of taste. But making one is not that hard if you keep it simple. Just make a new GUI, any size or shape you want, and add the inventory window element to it (click the button drag a box), that's it! By default it should have the right name for my module to work.
If you really want I could include my inventory bar as a seperate add-on, but it's not much more than what I just described plus some screen-edge-toggle magic. :)
Title: Re: [MODULE] SingleCursor 1.0
Post by: Mati256 on Mon 10/06/2013 02:40:11
Hi. I'm trying to use this module, but when I click in an inventory item, nothing happens.
When I click on an inventory item, my mouse should change to that item but that does not happen. Am I missing something?
Title: Re: [MODULE] SingleCursor 1.0
Post by: Crimson Wizard on Mon 10/06/2013 09:00:38
Quote from: Mati256 on Mon 10/06/2013 02:40:11
Hi. I'm trying to use this module, but when I click in an inventory item, nothing happens.
When I click on an inventory item, my mouse should change to that item but that does not happen. Am I missing something?
I have never seen this module before, but I guess it is worth to check "Override built-in inventory window click handling" global setting (should be TRUE).
Title: Re: [MODULE] SingleCursor 1.0
Post by: Mati256 on Mon 10/06/2013 11:20:40
Thank you CW. That was False, I changed it to true but it's still not working.
Title: Re: [MODULE] SingleCursor 1.0
Post by: hedgefield on Mon 10/06/2013 13:09:31
Hey Mati, I'm looking through the module script now (it's been a long time since I worked on it ha) and I see at the top some instructions that might help you. Did you:

- Make sure you have one GUI named gInventory with one inv window called InventoryWindow1 AND one existing inventory item?
- Put SC_CustomInvClicks = true; in your globalscript game_start function?

I hope either solves the problem, otherwise let me know and I'll spend an afternoon refamiliarizing myself with how this thing works exactly so I can better help you out.
Title: Re: [MODULE] SingleCursor 1.0
Post by: Mati256 on Mon 10/06/2013 22:21:02
Thank you! That was it. I missed that part of the instructions.
Title: Re: [MODULE] SingleCursor 1.0
Post by: Phemar on Wed 12/06/2013 13:36:26
Why use repeatedly_execute to check EVERY game loop if the player has changed the option? From the looks of it it only runs once when the game starts.
You could just make it a function: eg. SC.SetOption (eSC_CustomInvClicks, true); or SC.SetOption (eSC_SwapLeftRight, false); etc.
Title: Re: [MODULE] SingleCursor 1.0
Post by: hedgefield on Wed 12/06/2013 14:57:05
You have an excellent point, looking through this old code now I was surprised I even did it that way. Changing repeatedly_execute to game_start or making it a function should work just fine and save some processing power yes.
Title: Re: [MODULE] SingleCursor 1.0
Post by: Phemar on Wed 12/06/2013 18:36:55
Well I wouldn't put it in game_start, since the module's game_start will run before the global script's game_start and the player's change to the variable would register after you've checked its state.
Title: Re: [MODULE] SingleCursor 1.1
Post by: hedgefield on Wed 12/06/2013 19:45:05
Right you are, script order and everything! I'm a little rusty :) For those interested I updated the module to reflect this suggestion. Instead of the bool SC_CustomInvClicks there is now the function CustomInv(bool); I left the other one as a bool since that one didn't require any checking from the rep_ex, you can just set it directly. Further instructions and download link in the OP.
Title: Re: [MODULE] SingleCursor 1.1
Post by: Imc7r on Sat 24/02/2018 17:42:24
Sorry to bump but anyone knows why I get compilation error (All solved now)

SingleCursor.asc(31): Error (line 31): Undefined token 'ProcessClick' (I found answer here (http://www.adventuregamestudio.co.uk/forums/index.php?topic=51050.msg636504484#msg636504484) )

When using the script? Also what is meant by

- Make sure you have one GUI named gInventory with one inv window called InventoryWindow1 AND one existing inventory item? Where do I find this InventoryWindow1 window? Yes by default there is a gInventory GUI (ok I got this one too, just selecting and then renaming the window consisting of 4 vertices within the gInventory to InventoryWindow1 then the code would give more errors but renaming the old name of the inventory window to InventoryWindow1 in the below code in the global script compiles without an error.


Code (ags) Select
function btnInvUp_Click(GUIControl *control, MouseButton button) {
  InventoryWindow1.ScrollUp();
}

function btnInvDown_Click(GUIControl *control, MouseButton button) {
  InventoryWindow1.ScrollDown();

}