ID:171677
Aug 22 2004, 7:36 am
|
|
How would you code "If the user's contents contains a certain object"?
|
In response to EGUY
|
|
How could I implement a variable into an object name?
if(locate(/obj/"R[draft_round]P[draft_pick]")in src.contents) I keep getting this error: football.dm:199:error: "R[draft_round]P[draft_pick]": missing comma ',' or right-paren ')' football.dm:199:error: "R[draft_round]P[draft_pick]": missing comma ',' or right-paren ')' This is the whole of what im trying to do. var Im trying to make an nfl draft which I don't have to edit manually when someone creates another team so I don't have to edit the code to accomidate the number of draft picks. |
In response to ZLegend
|
|
Not sure if this is what your looking for but can't you use list?
for example: mob/var/totalplayers = 0 The players list can also have objs or mobs if you have players with individual skills. Just make players =list() then players += /obj/nfl_player. |
In response to EGUY
|
|
Well the list of players will be manually set for name creation and unique status reasons. So you won't have a running back who runs like a lineman or a kicker that blocks like a full back.
What im trying to do is implement a variable into the path name of an object. Here's how it works: The draft calls for the owner of Round2 Pick6 When the owner goes up to the "draft machine" it will check his inventory for obj/R"[draft_round]"P"[draft_pick]" but the complier wont let me put a variable into the object path. The whole purpose of this is so I don't have to manually create a team for someone who wants to start a franchise. Then go back and edit some more coding, then reboot the world which I try to avoid sometimes. and btw, what does while(src.totalplayers < 5) do? |
In response to ZLegend
|
|
idk
but maybe you could use: for(var/obj/A in [the list you are searching in]) This should work if you use it right. [EGUY] |
In response to EGUY
|
|
Wouldn't putting /obj/name of object in " " make it just text and not a path?
|
[EGUY]