ID:151414
 
Allo.

So with objects/mobs/whatever when a player right clicks them depending on how the verb is set you either see the verb when you right click or you dont. Then its either in your "verb list" or its not. simple enough

Well i want to make a visual banking system using onscreen (client screen) as opposed to the skin (as i dont want any popups). So when they click the item from the inventory which lets say is a "Stackable item" and has 450 in its amount.. Now a single click currently has 2 possibilities for me.
1. Add one of that unit to the bank. Simple enough
2. Make a input popup that askes how many you want to put in.

Id prefer to use Right click in this situation if possible.
So Bank 10, bank 100, bank X, and so on.

Now as far as i know the only option i can go with is just sticking those in the items verbs.. but that would then show up when right clicking the item even when not at a bank (and talking to the npc).

So my question basically is is there a way to be able to allow and disallow viewing of verbs whenever.

So when im out and around. Drop is the only option on right click but when banking i only have Bank X, 10, 100, 1000 etc.

~midget
Midgetbuster,

Based on your last question, i think you're looking for something along the lines of the set hidden variable. Look into that and you might find your answer.
Yours Truly,
-Lily S. Deliroso
You can reap a right click from the client/Click() procedure. I made a small library which expands on the basic click procedures to provide 12 (and up to 24) new clicking functions.
In response to DivineTraveller
Yea i already have your library i used it in a previous WIP. its a very nice and handy library.

As my above question kinda states i typed it up late at night so im unsure if its clear or not and portrays the message i wish it to entail.

So im basically trying to make Right Click.. making a list similar to that off the default atoms when you right click them (if they have verbs attached to them or can be verbed). but i want this right click list to more or less be dynamic. So at one stage it only has "Drop" and nothing else. and in other instances can have "Store X" (when banking so they cant drop on bank screen either)

Is this plausible?
In response to DarkLily762
I am aware of the hidden variable. As mentioned above. My question does loosely translate to something similar but as far as i am aware you are unable to change that var at runtime so its purpose does not stand.

~midget
In response to Midgetbuster
I think you might be able to (and yeah, it makes more sense now). I think you could get away with modifying the verbs list, a lot. Or, you might be able to use my tooltip demonstration to cobble together a list, based on whatever variables you want, and then display that. Obviously, this was only designed for a hover-tooltip, but you could modify it to spawn labels instead of a browser control (or you could use client/Topic and send all your verbs through that, too). The premise is similar, if not the same.
In response to DivineTraveller
Oo thats a nice demo. Could prove very usefull to me also. I had a search around and was led to believe a tooltip was no mans land.

As for tweaking it to display the list and what not.. im not exactly sure how i would do it. like displaying the verb on the list then being clicked to produce the required function
In response to Midgetbuster
Well, here's how I'd probably do it, in pseudocode:
right_click()
var/list/l = target_object.get_list_attributes()
var/s = tooltip(something, something, 24*l.length, something)
//this is because we want it to adjust to the list length, I forgot the other arguments
winshow(src, s, 0) // hide it for a sec
//alternatively, modify tooltip() to not show the window right away
for(var/new_verb in l)
for(var/x in verbs)
//not sure if this would work, but you just have to find the verb somehow
if(findtext("[x]", new_verb))
//create a new button -- tooltip() can be used as a reference, since it creates a browser
winset(src, newbutton, parent=s)
winset(src, newbutton, command=new_verb)
winshow(src, s)
//we can show the window again


obj/proc/get_list_attributes()
. = list()
if(can_be_thrownat) .+= "throwpieat"
if(can_be_obtained) .+= "get"
if(can_be_lookedat) .+= "lookat"

mob/verb
get
throwpieat
lookat

obj/var
can_be_lookedat
can_be_thrownat
can_be_obtained


this assumes that tooltip() returns the id of the tooltip -- that change would have to be made.
In response to DivineTraveller
I havnt looked into this fully yet due to being busy with driving lessons and other matters.

But i had a quick look into it today with the right click functions of your library i have only used shift/ctrl left clicks in the past.

But by the looks of things when i use the RightClick() procedure after including the library it does not output a simple usr << "b" message.. it works fine with leftclick, leftctrlclick etc. It does the default function of outputting the generic byond right click listing.

So i was just wondering in what way, if possible is there to flick between the 2 outputs.. i can understand probably just making it all procs and making it manually output using the tooltip library every time for both the everyday get/drop and the exclusive banking commands. Would that be the right way in thinking?
In response to Midgetbuster
Midgetbuster wrote:
I havnt looked into this fully yet due to being busy with driving lessons and other matters.

But i had a quick look into it today with the right click functions of your library i have only used shift/ctrl left clicks in the past.

But by the looks of things when i use the RightClick() procedure after including the library it does not output a simple usr << "b" message.. it works fine with leftclick, leftctrlclick etc. It does the default function of outputting the generic byond right click listing.

This also happens with my laptop. Some mice do not send RightClick() (if you see the comments on my library, I make note of this and mention that you should probably provide alternatives to right click). I apologize, but I cannot control that.

So i was just wondering in what way, if possible is there to flick between the 2 outputs.. i can understand probably just making it all procs and making it manually output using the tooltip library every time for both the everyday get/drop and the exclusive banking commands. Would that be the right way in thinking?

What do you mean "flick" between two outputs?
And I'm sorry, but I'm not sure I follow your thinking in the latter part of this paragraph.
In response to DivineTraveller
Well what i was referring to was the "default" output of "verbs" for byond when you right click an atom with verbs in it. more or less it was a useless statement.

And yea it would seem my mouse does not send a right click procedure to be recognized by your library.

Left and Middles work fine though. such a shame D:
In response to Midgetbuster
You have to edit the map control of your interface to send right clicks to the mouse procedures.
In response to Nadrew
Yup that allows it to be send perfectly.

But with the addition of that right clicking of players also becomes nulled, so that would also need a tooltip if i wished for players to be right clicked like that.

Would there be any other uses for enabling right click sends to be handled by procedures other then this library?
In response to DivineTraveller
Hmm i got some free time on my hands so with reference to the code you supplied.

Im having troubles actually making this export to the tooltip and display the needed functions.

Ive got errors (naturally) with newbutton, and unsure what to pin in there even with your little foot note.

also i had a little hickup with the tooltip proc returning a bad client using the default demo. but that was cause i didnt add in that "hidden" window in the interface which solved it once added so no biggy there that was when i was trying to import the demo directly into my game..

but as for making it work in a right click for items and or mobs making it display and output the verbs such as drop, bank etc its a total no go on all fronts.

Im returning Bad Client on trying to do tooltip() and im unsure on what to do with slotting in newbutton despite the footnote. ive looked at the demo and just cant figure out why this would be happening in items datum rightclick procedure. It works fine using the demos default way which i may fiddle with later which may end up erroring me aswell.

Mindboggling fun D:
In response to Midgetbuster
You actually need to create a new button. Here is the example from the reference:
var/list/params = new
params["parent"] = "mywindow"
params["type"] = "button"
params["text"] = "New button"
params["command"] = "say \"This is a new button.\""
params["pos"] = "10,10"
params["size"] = "80x20"
params["anchor1"] = "0,0"

winset(usr, "newbutton", list2params(params))

That's what I meant, although I apologize, the pseudocode made it very unclear, looking back, as it provided some but not all of the necessary parts.
In response to DivineTraveller
Hmm getting quite confused with the different stages now. since its going abit wongy everywhere.

items
parent_type = /obj

var
amount = 1
can_be_lookedat = 1
can_be_thrownat =1
can_be_obtained = 1

proc/get_list_attributes()
. = list()
if(can_be_thrownat) .+= "throwpieat"
if(can_be_obtained) .+= "get"
if(can_be_lookedat) .+= "lookat"

RightClick()
var/list/l = src.get_list_attributes()
var/s = tooltip(usr.client, "[usr.client.uid++]","[name]<br />", 256, 24*length(l), usr.client.mouse_x,usr.client.mouse_y, 30, FALSE)

// winshow(src, s, 0) // hide it for a sec
for(var/new_verb in l)
usr << "test1"
for(var/x in verbs)
usr << "test2"
if(findtext("[x]", new_verb))
//create a new button -- tooltip() can be used as a reference, since it creates a browser
var/list/params = new
params["parent"] = "mywindow"
params["type"] = "button"
params["text"] = "New button"
params["command"] = "say \"This is a new button.\""
params["pos"] = "10,10"
params["size"] = "80x20"
params["anchor1"] = "0,0"

winset(usr, "newbutton", list2params(params))


// winset(src, newbutton, parent=s)
// winset(src, newbutton, command=new_verb)
// winshow(src, s)


With variable S making the tooltip it refuses to make the tooltip due to a bad client error if i remove the clients MouseEntered proc.
Once you get past that problem having the winshow, src 0) etc in there will then also return a bad client error. and changing it from, src to anything pretty much makes a immediate crash.
The newbutton code you gave me.. im not entirely sure how to actually make it show up on the tooltip or make it run commands.


Ive also tried using the href system to.. but currently no luck trying to base it off what i did with click to whisper/mute to no success. ive set topic inside the object itself since thats where the procs are located and trying to just make it launch the procs accordingly (this requires me to make a list of what procs can be launched at what phase and define each proc launcher inside the topic)

but this also didnt work.. It doesnt pick up the link being clicked. Sigh..
In response to Midgetbuster
If you're using my library, you'll notice that in RightClick() there is a set of arguments sent to atom.RightClick() (client, location, params, and another one) -- you can get the client from that.
In response to DivineTraveller
It also requires me to use the mouse update proc. Which always needs a sleeper time on it with a minimum of sleep(2) to work without sending me a bad client.

    RightClick(mob/clicker, location, control, params)
clicker.client.update_mouse()
sleep(2)
tooltip(clicker, "[clicker.client.uid++]","[name]<br /><a href='?src=\ref[clicker];action=googleberries'>Test One.</a>", 256, 24*3, clicker.client.mouse_x,clicker.client.mouse_y, -1, FALSE)


as for getting the href's and what not to work. im still in that phase with no current luck.

Just another question to spring on you.

With the right click menu and tooltips i dont want them to fade out so i want them to be permanently there more or less until they take there mouse off..

So i need to be able to check that there mouse is on the item when rightclicking and when moving it off i need the menu to change its thing so then it can fade out. From what i can see using the tooltip uid -may- be able to do something like this but ill let you see if you know or not.
In response to Midgetbuster
To do something like that, I guess what you could do is:
look for any active tooltip uids (obviously you'll have to track these yourself)
get the current mouse position, as well as the size for any tooltips
construct a boundary that the mouse can move in, and have something like:
spawn while(in_bounds())
update_mouse()
sleep(1)

in_bounds()
return x<box_max_x && x>box_min_x && y>box_min_y && y<box_max_y

.. then if it isn't in bounds, tell it to fade.

That's my idea on how it can be done, but I'm not sure how practical it is. I've been told by Hiro The Dragon King that you can actually offload update_mouse() to be an infinite loop using javascript, to have it continually update, but I wasn't able to get it to work, so I did it a bit differently.
In response to DivineTraveller
Hmm, ive had a fiddle around with the code and ive had absolutely no luck in trying to find any active tooltips. Ive used the supplied UID as stated it is meant to track the number of the current tooltip that has been created.

But i cant seem to find the window, maybe im just doing it wrong i figured a if(winexist) proc would work to check for it. but it doesn't seem to want to be that easy

Ive currently tried to play with MouseExited for seeing if they have left the zone. If i can get it to work ill need to be able to actually ensure they "hover" over the tooltip as opposed to just passing through it..

    MouseExited(atom/item, location, control, params)
if(istype(item,/items))
if(winexists(src, "[uid].[uid]_browser"))
src << "1. Success"
else
src << "1. Fail"
if(winexists(src, "[uid]"))
src << "2. Success"
else
src << "2. Fail"
if(winexists(src, "[uid]_browser]"))
src << "3. Success"
else
src << "3. Fail"


I tried that for a simple test phase to see if i could find it. the elses are kinda pointless but i wanted to make sure that it was actually running the if statement.

Im probably doing it wrong but who knows =\

And in regards to the code you supplied i think i mentioned it in the other text in this post but as you also said im not sure how practical it would be either as by the looks of things if the mouse does indeed go outside the object would it not cause the tooltip to expire? im not sure since i dont know how that code works or where to implement it. but with mouseexited it allows me to fiddle inside the tooltip itself and if i move outta the tooltip closes it off. (well in the current case when it fades out. but all the same i guess)
Page: 1 2