One Click Handler Script

Started by kurt_indovina, Sat 03/09/2016 18:36:18

Previous topic - Next topic

kurt_indovina

Greetings folks,

I'm new to the community, and I'm very excited to be here.

Now to the point: I'm still in the tutorial stages of learning the engine, and I'm moving along fine for the most part.

I am, however, having trouble creating a script for One Click functionality. For example, I want everything done with the left click. My only need for the right click is to DISREGARD the inventory item, and to OBSERVE an item when in the inventory. Example games: The Journey Down (AGS version), The Dream Machine.

I've been searching the forums and googling quite a bit, and the closest I've come is to the BASS-style script. I'm sure there's a script out there, and I'm just completely missing it. Any help would be MASSIVELY appreciated.

And again, I'm excited to be here, and have taken too long for me to do so.

-Kurt

morganw

I've not looked very closely at the BASS-style script, but I'm pretty sure that (by default) inventory clicks are processed for you by the engine, and so it makes assumptions about what a left and right click does. If you want to process these clicks yourself (where you can decide what a left and right click does) you need to set an engine option. These options are in the manual, but are quite hard to find.

OPT_HANDLEINVCLICKS is described as "Handle inventory clicks in script (0 or 1)", so you would set it like this:
Code: ags
SetGameOption(OPT_HANDLEINVCLICKS, 1);



Crimson Wizard

Quote from: morganw on Sat 03/09/2016 20:29:49
OPT_HANDLEINVCLICKS is described as "Handle inventory clicks in script (0 or 1)", so you would set it like this:
Code: ags
SetGameOption(OPT_HANDLEINVCLICKS, 1);


You can also set this in General Settings.

Crimson Wizard

Quote from: kurt_indovina on Sat 03/09/2016 18:36:18
I've been searching the forums and googling quite a bit, and the closest I've come is to the BASS-style script. I'm sure there's a script out there, and I'm just completely missing it. Any help would be MASSIVELY appreciated.
I am actually curious why BASS template did not suit you (unfortunately, you never explained it). Even if you wanted something act differently, you could take it as a base and modify to your needs.

Danvzare

I'm with CW, you can easily modify the BASS template.

As a matter of fact just use the BASS template as is, and don't put in any interactions for right clicking (looking at) objects.
It's as simple as that.

kurt_indovina

Quote from: Crimson Wizard on Sun 04/09/2016 13:41:41
Quote from: kurt_indovina on Sat 03/09/2016 18:36:18
I've been searching the forums and googling quite a bit, and the closest I've come is to the BASS-style script. I'm sure there's a script out there, and I'm just completely missing it. Any help would be MASSIVELY appreciated.
I am actually curious why BASS template did not suit you (unfortunately, you never explained it). Even if you wanted something act differently, you could take it as a base and modify to your needs.

Crimson Wizard, you're right, I was quite vague looking back at my post.

This is what I want to do:
Left Click: move/look/interact/talk (all the verbs)
Right Click: Disregard item/examine inventory item

BASS seems to be:
Left: walk/interact
Right: everything else

After looking at the coding for BASS, I thought it seemed easy to change the code around, but whenever I shifted things around to how I saw fit, the game wouldn't run.

Now admittedly, I'm not a coder, and this is my first introduction to coding (aside from some basic HTML), and I got very frustrated trying to figure it out. So out of frustration, I figured I'd post here just in case there was a basic script already out there that I was missing.

I hope that clears things up a bit. Maybe with sometime away from it, I'll go back and hopefully just be able to switch a few lines of code around, and make sense of it.

Thanks for the responses, folks!

kurt_indovina

Quote from: Danvzare on Sun 04/09/2016 16:30:11
I'm with CW, you can easily modify the BASS template.

As a matter of fact just use the BASS template as is, and don't put in any interactions for right clicking (looking at) objects.
It's as simple as that.

You're absolutely right, and that's what I was figuring in doing! Good call. You're awesome

SMF spam blocked by CleanTalk