ID:2627626
 
Resolved
When reading the length of client.verbs directly, a value of 0 was returned.
BYOND Version:513
Operating System:Windows 10 Home
Web Browser:Firefox 82.0
Applies to:Dream Daemon
Status: Resolved (513.1537)

This issue has been resolved.
Descriptive Problem Summary:
client.verbs is not readable.
verbs += /client/verb/whatever

will add the verb to the client, however client.verbs will still be an empty list.

Numbered Steps to Reproduce Problem:
Add verbs to client.verbs. Check client.verbs, it will be empty.

Workarounds:
Store your own list of verbs that are assigned to clients.

Additional Notes:
This is not the case for verbs on any other objects, for example mob.verbs contains a list of all verbs that can be used by the mob, however mob.client.verbs will contain nothing.

edit: The verbs in the list are readable, however .Find doesn't work and .len always returns 0 on the client verbs. If you copy the verbs list, then .len and .Find work as intended.

Test Case:
/*
These are simple defaults for your project.
*/


world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default

view = 6 // show up to 6 tiles outward from center (13x13 view)


// Make objects move 8 pixels per tick when walking

mob
step_size = 8

obj
step_size = 8

/client/proc/secret_proc()
src << "EEK"

/client/New()
. = ..()

src << "==Empty Test=="
src << verbs.len
for(var/i in verbs)
src << i
src << "Finished"
verbs += /client/proc/secret_proc
src << "==List Test=="
src << verbs.len
for(var/i in verbs)
src << i
src << "Finished"
src << "==FIND TEST=="
if(verbs.Find(/client/proc/secret_proc))
src << "Verb found!"
else
src << "Verb not found!"
src << "==Copy Test=="
var/list/new_list = verbs.Copy()
src << "Copy Length: [new_list.len]"
for(var/i in new_list)
src << i


==Empty Test==
0
Finished
==List Test==
0
/client/proc/secret_proc
Finished
==FIND TEST==
Verb not found!
==Copy Test==
Copy Length: 1
/client/proc/secret_proc

Copied list length is fine, it's just verbs.len returns 0. Additionally, find always seems to return 0 too when done from the verbs list.
Do you have a test case for this? The code suggests there shouldn't be any issue reading client.verbs, so I'm wondering if there's something wrong with the way you're accessing the list. You didn't include any code to show how you're trying to read from it, so I can't tell.
Coming from SS13 here
Added this code to the end of /client/New()
    message_admins("Adding verb to client")
message_admins("Before verbs: [verbs.len]")
verbs += /client/verb/do_funny
message_admins("Verb added, new verbs: [verbs.len]")

/client/verb/do_funny()
set name = "Do funny"
set category = "IC"
mob.gib()


When loading the game this happens
https://cdn.discordapp.com/attachments/345978623037145088/ 769291224736727050/unknown.png
However in the IC category the action is there.
https://cdn.discordapp.com/attachments/345978623037145088/ 769291359685181500/unknown.png

When accessing through variable edit, the verbs on my mob are visible however, the verbs on my client are not.
https://cdn.discordapp.com/attachments/345978623037145088/ 769291534314373130/unknown.png
Client Verbs:
https://cdn.discordapp.com/attachments/345978623037145088/ 769291580619620362/unknown.png
The verbs list in that editor is not accessed the same way you're doing it in the code snippet, though. The info here is very scattered so I need a test case.
The message admins screenshot in the first one was the code snippet I provided and the length of verbs on the client before was 0 and after adding the verb was still 0 despite do-funny being accessable under the IC tab of the stat panel
I really need a test case for this that can show me consistent information. Anecdotes and screenshots just aren't getting it done.
make a fucking test case project @powerfulbacon before i declare this forum a vegetarian only space

space station 13 is not a test case, it is a fully formed production video game

reproduce this in a BLANK DM project, and then post it + the project here
Test case:
/client/proc/do_funny()
src << "Honk"

/client/New()
..()

src << "[verbs.len]:"
for(var/v in verbs)
src << "- [v]"
src << "end."

verbs += /client/proc/do_funny

src << "[verbs.len]:"
for(var/v in verbs)
src << "- [v]"
src << "end."


Expected output:

0:
end.
1:
- /client/proc/do_funny
end.


Actual output:

0:
end.
0:
- /client/proc/do_funny
end.


It seems like the problem is only with the .len var.
/*
These are simple defaults for your project.
*/


world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default

view = 6 // show up to 6 tiles outward from center (13x13 view)


// Make objects move 8 pixels per tick when walking

mob
step_size = 8

obj
step_size = 8

/client/proc/secret_proc()
src << "EEK"

/client/New()
. = ..()

src << "==Empty Test=="
src << verbs.len
for(var/i in verbs)
src << i
src << "Finished"
verbs += /client/proc/secret_proc
src << "==List Test=="
src << verbs.len
for(var/i in verbs)
src << i
src << "Finished"
src << "==FIND TEST=="
if(verbs.Find(/client/proc/secret_proc))
src << "Verb found!"
else
src << "Verb not found!"
src << "==Copy Test=="
var/list/new_list = verbs.Copy()
src << "Copy Length: [new_list.len]"
for(var/i in new_list)
src << i


==Empty Test==
0
Finished
==List Test==
0
/client/proc/secret_proc
Finished
==FIND TEST==
Verb not found!
==Copy Test==
Copy Length: 1
/client/proc/secret_proc

Copied list length is fine, it's just verbs.len returns 0. Additionally, find always seems to return 0 too when done from the verbs list.
I think it's worth noting that verbs already defined for the client at compile time also don't affect the list length:

client/verb
blankverb()
world << "This verb doesn't do anything."
mob/verb
listverbs()
var/list/l = client.verbs
for(var/v in l)
world << "[v]"
world << "Length: [l.len]"


listverbs() outputs this:

/client/verb/blankverb
Length: 0
Lummox JR resolved issue with message:
When reading the length of client.verbs directly, a value of 0 was returned.