ID:134259
 
Could there be an atom/var to block the Dream Seeker .click command (or maybe even only macros of it) for that atom, to force people to actually click things rather than have a pre-made macro of the .click command?
The only workaround I can think of for this is to randomly modify the 'name' variable. :\
mob/verb/ClickBlock()
set name = ".click"
src<<"Macroing the Click function is not allowed."
return


I love object-oriented programming ^_^
In response to DarkCampainger
DarkCampainger wrote:
> mob/verb/ClickBlock()
> set name = ".click"
> src<<"Macroing the Click function is not allowed."
> return
>

I love object-oriented programming ^_^

It works?!
I don't think so, because the command goes like ".click atom-name", not just ".click"...so it shouldn't block it.
Also, if it works, it blocks it for ALL atoms...this var is for blocking specific ones (let's say I don't want players to be able to use click macros on my Catch-a-Mole minigame, but I wanna allow them to use it on other things if they wish).
In response to Kaioken
mob/icon='T.dmi'
turf/icon='Colors.dmi'

atom/var/CanMacro=1

obj
icon = 'Apple.dmi'
Click()
usr<<"APPily!"


obj/Mole
CanMacro=0
icon = 'Mole.dmi'
Click()
usr<<"I no lik'a dah macros.."

mob/verb/ClickBlock(A as anything in view())
set name = ".click"
if(istype(A,/atom))
var/atom/B = A
if(B.CanMacro) B.Click()
else src<<"Macroing the Click() function to [B] is not allowed."


Tested and works fine. Let's you click both apples and Moles, lets you macro clicking the apples, but doesn't let you macro clicking the moles. :p
In response to DarkCampainger
Damn, I'm an idiot, I forgot that arguments are supplied to verbs just like that! *smacks head* This is what I get for not sleeping enough.

The actual code could be improved, though;
#define SNG_CLICK 1 //define bits
#define DBL_CLICK 2

atom/var/block_click_cmd //=null //by default, block none

//--------- <for testing> --------------
/*
mob/block_click_cmd = SNG_CLICK|DBL_CLICK //block both single .click and .dblclick for mobs
turf/block_click_cmd = SNG_CLICK //block only single click for turfs
*/

mob/verb/ChngClick()
set name = "Change .click-abillity"
set desc = "Change whether the .click commands are allowed on you"
switch(input("Allow single-.click-ing you?") in list("Yas","No"))
if("Yas") src.block_click_cmd &= ~SNG_CLICK
else src.block_click_cmd |= SNG_CLICK
switch(input("Allow .dblclick-ing you?") in list("Yas","No"))
if("Yas") src.block_click_cmd &= ~DBL_CLICK
else src.block_click_cmd |= DBL_CLICK
src << "Done."

//turf/Click() flick("something",src) //to test if it works only for
//objects of specified name within view, and not for objects of
//specified name that may be miles away

atom/DblClick(l)
usr << "<font color=blue>You DOUBLE clicked [src]! (At: [l])"
atom/Click(l)
usr << "<font color=blue>You clicked [src]! (At: [l])"
mob/Login()
. = ..()
src.contents += new /obj{name="test_click_me_in_statpanel"}
//mob/Stat() statpanel("Inventory",src.contents)
//--------- </for testing> --------------

client/verb
SNG_Click_Block(atom/A as null|mob|obj|turf|area)
set name = ".click" //this also sets verb as hidden
if(!istype(A) || !(A in view(src.view,src.mob))) //cancel if A is invalid OR it isn't visible to the player mob (using properly-argumented view() proc :p)
src << "\red ERROR: Invalid argument supplied for '.click' command."
return null
if(!(SNG_CLICK & A.block_click_cmd)) //if the SNG_CLICK bit isn't on in block_click_cmd
return src.Click(A,A.loc) //call client/Click(), rather than straight atom/Click().
src << "<font color=#FF69B4>ERROR: The '.click' command is disabled for [A].</font>"
DBL_Click_Block(atom/A as null|mob|obj|turf|area)
set name = ".dblclick" //this also sets verb as hidden
if(!istype(A) || !(A in view(src.view,src.mob))) //cancel if A is invalid OR it isn't visible to the player mob (using properly-argumented view() proc :p)
src << "\red ERROR: Invalid argument supplied for '.dblclick' command."
return null
if(!(DBL_CLICK & A.block_click_cmd)) //if the DBL_CLICK bit isn't on in block_click_cmd
return src.DblClick(A,A.loc) //call client/DblClick(), rather than straight atom/DblClick().
src << "<font color=#FF69B4>ERROR: The '.dblclick' command is disabled for [A].</font>"


Nevertheless, thanks! :)
Note: You can't use 'in view()' in the argument definition thing. It will cause runtime errors when you try to use command autocomplete on .click (if you have an object named "grass",type in commandline '.click gra' and press space). This way works fine, even if there are tons of objects named "thing" on the world, and you do ".click thing" in the command line, it will only choose one in view (not sure why it does this despite the argument missing, but hey, I'm not complaining :D). And the autocomplete still works.

Though, this snippet isn't perfect. Look in the reference: The Click() procs have an argument; now, I'm not sure, I MAY of successfully imitated the loc-part of it by calling with the 'A.loc' ; however I haven't, and I can't, imitate the useful if-object-in-statpanel-set-arg-to-statpanel-name part, so if people rely on this arg in their game this will break their code. So my suggestion to add this as built-in is still in place.
(However, pleasant reader, if you don't use the Click() statpanel-name arg in your game, then you can use this workaround safely.)