ID:150513
 
The title pretty much sums up my question.

Currently, there is no way to assign an icon to a verb. However, you can achieve a similar effect by creating "command" objects for each action and displaying these in a stat panel.

Example:

mob/var
   commands[] = newlist(/obj/command/say,/obj/command/grin)
mob/Stat()
   statpanel("Commands",commands)

obj/command
   say
      icon = 'say.dmi'
      Click()
         //prompt for further input
   grin
      icon = 'grin.dmi'
      Click()
         view() << "[usr] grins."

In response to Dan
Dan wrote:
Currently, there is no way to assign an icon to a verb. However, you can achieve a similar effect by creating "command" objects for each action and displaying these in a stat panel.

Hey Dan! I haven't heard from you in a while!

That is remarkable! I didn't know you could do that! Wowee, gee willickers!

Thanks!
In response to Vortezz
I have seen it done in a few games it is setup like this
[Commands Tab]

[icon of a sword] Sword Attack.







i wanna know how to do that.
In response to SonVegitto
SonVegitto wrote:
I have seen it done in a few games it is setup like this
[Commands Tab]

[icon of a sword] Sword Attack.


i wanna know how to do that.

The example I posted does exactly that. You just have to substitute "say" with "sword".

In response to Dan
Hmm... I just tried that, and they're not appearing! Ack, how odd.. I wouldn't know the reason for it, because I've never used objs in lists, and whatnot, very much.. Here's what I've tried.


mob/var
commands[] = list(/obj/command/say,/obj/command/shout)
mob/Stat()
statpanel("Commands",commands)

obj/command
icon = 'commands.dmi'
say
icon_state = "say"
Click()
var/msg = input("Speak to those in view.")
oview() << "[usr] says, <small>\"[msg]\".</small>"
shout
icon_state = "shout"
Click()
var/msg = input("Shout, so everyone can hear you.")
world << "[usr] shouts, <big>\"[msg]\".</big>"




When running that, I get nothing in my commands panel. I could just do a New() workaround, but then it'd be in my inventory panel, no?
In response to Vortezz
I had the same sort of problem with stat panels until I finally figured it out. Try this code instead:

statpanel("Commands")
stat(commands)

I found out by hard example that for some reason, stat("Inventory",src.contents) doesn't work, but inventory works if you add the list on its own.

Lummox JR
In response to Dan
Dan wrote:
Currently, there is no way to assign an icon to a verb. However, you can achieve a similar effect by creating "command" objects for each action and displaying these in a stat panel.

Example:

> mob/var
>    commands[] = newlist(/obj/command/say,/obj/command/grin)
> mob/Stat()
>    statpanel("Commands",commands)
>
> obj/command
>    say
>       icon = 'say.dmi'
>       Click()
>          //prompt for further input
>    grin
>       icon = 'grin.dmi'
>       Click()
>          view() << "[usr] grins."
>



o.o ! Thats a nice idea :) thanks Dan!