ID:155565
 
Is there a way to use it but not call the Click() of the clicked target period?
Not built-in, but it looks like it would be fairly easy to add. You could add an override variable to the GetClick datum (and set it in New()). Then under client/Click(), if clickwaiting.override is true, just return early before the ..() call.
In response to DarkCampainger
I came up with these 2 codes. Is either one correct?

client
var/GetClick/clickwaiting
Click(object)
if(clickwaiting)
clickwaiting.receive(object)
clickwaiting = null
return // Will stop the procedure in it's tracks
..()


or

client
var/GetClick/clickwaiting
Click(object)
if(clickwaiting)
clickwaiting.receive(object)
clickwaiting.override = 1
if(clickwaiting.override = 1)
clickwaiting = null
return // Will stop the procedure in it's tracks
else
click.waiting = null
..()
In response to Lugia319
Well, they both will always block atom.Click(). I was thinking of something a little more versatile:

/*
Garthor.GetClick
- Minor alteration with override option

Simple proc that will return the next thing a player clicks on, blocking until then
Overrides:
client/Click()
client/Del()
Returns:
on success: object clicked on
on failure: null
*/


client
proc
GetClick(var/priority = 1, var/timeout = 36000, var/override = 0)
var/GetClick/G = new(src, priority, override)
if(G)
return G.get(timeout)

// Forward the request to client/GetClick()
mob
proc
GetClick(var/priority = 1, var/timeout = 36000, var/override = 0)
if(!client)
return
else
return client.GetClick(priority, timeout, override)

//handler datum
GetClick
var/priority = 1
var/override = 0
var/GetClickHelper/helper
var/returnvalue
New(var/client/C, var/priority = 1, var/override = 0)
..()
helper = new()
src.priority = priority
src.override = override
//if there's no waiting click, just enter us into the queue
if(!C.clickwaiting)
C.clickwaiting = src
//if there is, and are a higher or equal priority, send it a null click and replace it
else if(C.clickwaiting.priority <= priority)
C.clickwaiting.receive(null)
C.clickwaiting = src
//if there is a waiting click and we are a lower priority, just delete us
else
del(src)
proc
get(var/timeout = 36000)
//have the helper sleep until time is up or it is deleted
helper.help(timeout)
. = returnvalue
del(src)
receive(var/object)
//interrupt the helper's help() proc by deleting it, allowing get to finish
returnvalue = object
del(helper)


//helper datum
GetClickHelper
proc
//his idea of helping is to sit around doing nothing
help(var/timeout = 36000)
sleep(timeout)


client
var/GetClick/clickwaiting
Click(object)
if(clickwaiting)
clickwaiting.receive(object)
var/override = clickwaiting.override
clickwaiting = null
if(override)
return // prevent the default action (atom.Click())
..()
Del()
if(clickwaiting)
del(clickwaiting)
..()


Note that you shouldn't ever make changes to code within a library itself, so you should place this into a code file in your project. Now you can call GetClick() and set its override variable to true, causing it to block atom.Click():

GetClick(,,1) // Enable override (leaving the first two settings to default values)
In response to DarkCampainger
Thanks. Yeah I was really nervous about editing the library but I figured I could always re-download it if necessary.
I've updated the library with the functionality to do this. A true value for the new third argument to GetClick() (override) will suppress the normal Click() call.

This may potentially result in conflicts with other libraries if they also modify client/Click(), however.

The change is also almost identical to DarkCampaigner's, but that's simply coincidental: I totally didn't even look at it.
In response to Garthor
Awesome, thanks Garthor.
In response to Garthor
Saw this post while I was digging on a way to do something similar involving the interface file though (buttons to be more specific) and was wondering if its compatible with buttons, and if so, what does it return? The button ID / button text? If not, is it possible to be done and how.

Thanks in Advance!