ID:177066
 
There seems to be an odd occurance, it's as if BYOND tracks objects by their name so when you have something to effect of:

obj/computer in a list, it only tracks it by the computer's name field. This means that multiple entries within a list end up to be just one and the first object to enter the list is ALWAYS selected without questioning the user first.

Is there some way that you could track a list of objects with the same name without BYOND thinking that they are all the same object because the name is similar without using some form of hack with spacing or something to that effect?

This is causing problems in a friend of mine's game and my own.

Thanks,
SW
None of what you said really makes any sense, unless you're talking about list associations. If that's the case, then it seems you're using them in a way that they're not meant to be used. But without code, there's no telling what you're on about.

Lummox JR
In response to Lummox JR
Ok, if I'm standing on Square X with two Computers whose paths and names are generic such as:

/obj/computer/Terminal
name = "Terminal"

If there are two of them near me and I do anything related to a listing of them, say an Input() proc asking which computer you would like to use or more specifically:

var/list/Compies = new/list
for(var/obj/computer/C in oview(1))
if(!C.Hacked)
Compies += C
world << "[C]: [C.Hacked] -- [C.Security]"
if(Compies.len == 0)
usr << "No computers to hack"
return
var/obj/computer/T = input("Please select a computer to hack","Hack this!") in Compies

It will never ask me which of any in oview(1) if they have the same name.

The problem seems to be that BYOND doesn't discriminate based on names. With two objects of the same name, it doesn't seem to discern between the two of them in this case. So if there are two of the same object in oview(1) it will only access the first one that's added to the list. The others seem to not be added to the list afterwards.

Is there a way to get around this that isn't a hackish method ( such as adding spaces, numerals, etc. ) to the name?
In response to ShadowWolf
ShadowWolf wrote:
Ok, if I'm standing on Square X with two Computers whose paths and names are generic such as:

/obj/computer/Terminal
name = "Terminal"

If there are two of them near me and I do anything related to a listing of them, say an Input() proc asking which computer you would like to use or more specifically:

var/list/Compies = new/list
for(var/obj/computer/C in oview(1))
if(!C.Hacked)
Compies += C
world << "[C]: [C.Hacked] -- [C.Security]"
if(Compies.len == 0)
usr << "No computers to hack"
return
var/obj/computer/T = input("Please select a computer to hack","Hack this!") in Compies

It will never ask me which of any in oview(1) if they have the same name.

The problem seems to be that BYOND doesn't discriminate based on names. With two objects of the same name, it doesn't seem to discern between the two of them in this case.

Ah, and this is the key to it:
BYOND does discriminate between the objects, but input() doesn't; you left this crucial piece of info out of your first post.

The input() proc will pop up a list of the items it's given, and for expediency's sake it won't repeat anything; it'll assume one of them is as good as any other.
The solution to this is to make your own list, with different names.
var/list/L=new
for(var/obj/computer/Terminal/T in oview(1))
var/dirstring=""
var/dirto=get_dir(usr,T)
if(dirto&(NORTH|SOUTH)) dirstring+=(dirto&NORTH)?"N":"S"
if(dirto&(WEST|EAST)) dirstring+=(dirto&WEST)?"W":"E"
if(dirstring)
L["[T.name] ([dirstring])"]=T
else
L[T.name]=T
And now you have a unique list. It'll show the terminals and the direction they're in.

So if there are two of the same object in oview(1) it will only access the first one that's added to the list. The others seem to not be added to the list afterwards.

Is there a way to get around this that isn't a hackish method ( such as adding spaces, numerals, etc. ) to the name?

What would be the point of getting around it with the same apparent name? You'd see a list of items with identical names you couldn't tell apart, so there'd be no way of knowing which item was actually intended.
Adding numerals, however, is a very good way of telling these things apart.

Lummox JR