[MODULE] SingleCursor 1.1

Started by hedgefield, Mon 12/09/2011 16:54:49

Previous topic - Next topic

hedgefield

Since I can't seem to post in the Modules board anymore, here goes:

Following this thread 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

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.

DangerDinosaur

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.

hedgefield

Oh woops sorry, put it in the wrong directory. Fixed.

Kweepa

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 :=
Still waiting for Purity of the Surf II

hedgefield

Hm, I was semi-convinced I had posted there before. I guess those must have been inceptions. :)

Grim

I'm struggling with setting up a working inventory... How about going one step further and adding a fully functional inventory?... Pretty pretty please?... ;)

hedgefield

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. :)

Mati256

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?
My Blog! (En Español)

Crimson Wizard

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).

Mati256

Thank you CW. That was False, I changed it to true but it's still not working.
My Blog! (En Español)

hedgefield

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.

Mati256

Thank you! That was it. I missed that part of the instructions.
My Blog! (En Español)

Phemar

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.

hedgefield

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.

Phemar

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.

hedgefield

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.

Imc7r

#16
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 )

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
function btnInvUp_Click(GUIControl *control, MouseButton button) {
  InventoryWindow1.ScrollUp();
}

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

}

SMF spam blocked by CleanTalk