ID:179031
 
this is what im trying to do I want the object/var pow to be affected when I interact with a different obj heres what I have so far.


obj
computerwarp
icon = 'computer.dmi'
icon_state = "warppower"
name = "warp control"
density = 1
verb/warp_control()
set src in oview(1)
switch(input("What?")in list("Turn off","Eject"))
if("Turn off.")
diagnostic.pow -=

obj
diagnostic
icon = 'computer.dmi'
icon_state = "diagnostic"
name = "diagnostic"
density = 1
var
pow = 3

it gives me an error saying diagnostic.pow is a bad var.

please help.
computerwarp.warp_control() has no idea that obj/diagnostic exists, let alone obj/diagnostic.pow. warp_control() is looking for a variable named diagnostic within warp_control(), within computerwarp, or global. There is none, so it complains.

Is a computerwarp supposed to own a diagnostic? If so, give computerwarp a diagnostic var.

obj/computerwarp/var/obj/diagnostic/diagnostic
In response to ACWraith
I know im aproaching it the wrong way but I need the pow var on diagnostic to be affected when the usr interacts with a verb attached to the computerwarp obj is there a way to do that?

computerwarp does not own diagnostic, diagnostic is its own obj with its own verbs attached.
In response to Treasurecat
You can add a diagnostic var to computerwarp of type obj/diagnostic as I suggested.

You can have the user pass an obj/diagnostic into the verb as one of the parameters.

You can access a global obj/diagnostic which would be the same for everyone.

You can try to get an obj/diagnostic from the user of the verb by accessing procs/vars/verbs of the user.
In response to ACWraith
ACWraith wrote:
You can add a diagnostic var to computerwarp of type obj/diagnostic as I suggested.
I have two verbs attached to obj/diagnostic that reqires the var/pow to be affected to give different responses so I dont thank that would do what I want wich is to change diagnostic.pow to = 2

You can have the user pass an obj/diagnostic into the verb as one of the parameters.
would this be like taking a var and giving it to the user?
if thats the case that would work as long as its the diagnostic.var being afected while the player is interacting with the obj/computerwarp

You can access a global obj/diagnostic which would be the same for everyone.
I think this would work out but I dont know how to make obj/diagnostic global and in a way I thought it already was

You can try to get an obj/diagnostic from the user of the verb by accessing procs/vars/verbs of the user.
if that means adding the command to the user I wanted the verb to be atached to the object so that the verb can only be used when your standing next to obj/diagnostic

its hard right now for me to keep all this straight ive only been at this for less than a week but I really appreciate your help thank you.
In response to Treasurecat
I can atach a verb to any object and make the usr var go up and down thats really all I want to do with the diagnostic var
In response to Treasurecat
Treasurecat wrote:
I can atach a verb to any object and make the usr var go up and down thats really all I want to do with the diagnostic var

I was confused as to whether you were saying you figured it out or were clarifying your request. I made this demo just in case...

</DM>
mob/MyMob

var
myVar_ = 0

New()
..()
// Just adding MyObj to contents because
// I'm not bothering with a map to get it from
contents += new/obj/MyObj

Stat()
if (src == usr)
// Just showing that the obj is held by the user
// because I'm not bothering with icons or maps
statpanel("inventory",src.contents)

// Showing that the var is indeed changed
// after using MyVerb()
statpanel("myVar_",src.myVar_)

proc
// Being anal about not letting outside
// things touch private variables
AddMyVar(SomeNum = 0)
myVar_ += SomeNum

obj/MyObj

verb
MyVerb()
// Being anal about type checking
if (istype(usr,/mob/MyMob))
var/mob/MyMob/mymob = usr
// We have access to the user
// so we have access to the
// things the user does
mymob.AddMyVar(-2)

world

mob = /mob/MyMob
</DM>
In response to ACWraith
no unfortunatly I still havnt fixed this problem. thanks for the demo but all that does is affect my player mob/var
the object im trying to manipulate is not in the players inventory its stationary what I want to do is

have two objects
object A has a var that = 1
object B has a verb that - 1 from the var for object A
I didnt think I would have this much of a problem since I can attach a verb to an object and make that verb affet a usr/var so I thought it would be the same concept for two objects.

would it help if I made object A a mob? I dont see how but ive been trying all sorts of things.
In response to Treasurecat
Pardon the long quotes. These things just seemed easier to answer one at a time.

Treasurecat wrote:
ACWraith wrote:
You can add a diagnostic var to computerwarp of type obj/diagnostic as I suggested.
I have two verbs attached to obj/diagnostic that reqires the var/pow to be affected to give different responses so I dont thank that would do what I want wich is to change diagnostic.pow to = 2


Someone can activate the computerwarp verb. The computerwarp can call on the diganostic. The diagnostic can change itself however computerwarp told it to.


You can have the user pass an obj/diagnostic into the verb as one of the parameters.
would this be like taking a var and giving it to the user?
if thats the case that would work as long as its the diagnostic.var being afected while the player is interacting with the obj/computerwarp


It would not be like this. It would be like the user saying "here, have a diagnostic" to the verb so the verb has something to work with. The catch is the user needs a way to get the diagnostic to give to the verb.


You can access a global obj/diagnostic which would be the same for everyone.
I think this would work out but I dont know how to make obj/diagnostic global and in a way I thought it already was


The type itself is global, but you did not make a var of that type. You defined how an obj/diagnostic would behave, but you did not make any obj/diagnostic things to behave.

You can use the help files in DM or the reference on this site to figure out how to use global.


You can try to get an obj/diagnostic from the user of the verb by accessing procs/vars/verbs of the user.
if that means adding the command to the user I wanted the verb to be atached to the object so that the verb can only be used when your standing next to obj/diagnostic


No, this option is more like passing in the diagnostic as a parameter, except that the user does not have to specify the diagnostic. The user would just use the command however you set it up. In an obj is fine. That obj's verb would then make a silent request to the user for the diagnostic to act on.


its hard right now for me to keep all this straight ive only been at this for less than a week but I really appreciate your help thank you.


Relax, it's called Newbie Central. :)
In response to Treasurecat
The only thing you really need to decide is how an obj such as computerwarp has access to an obj such as dignostic. Does it look for one within view? There could be many so which one? Does it just have a reference to a diagnostic in its vars for easy access? Is there one global diagnostic that all computerwarps access? Does something else with access to diagnostics pass them to computerwarps to act on? Make a design decision.

If you are trying to use usr for an obj, you are out of luck. According to the help files, usr is a mob. This does not mean you need to change something into a mob to do what you want. This just means that you can't use usr to directly pass the obj/diagnostic to the obj/computerwarp.
In response to ACWraith
I still cant seem to get the hang of this one

when I say I want one to interact with the othere what I meant is this.
the player enters a room with two computers/objects I want him to be able to use a verb with one which causes the others varible to go down. I read the refrence to global and that wont work for me this is what I have so far

obj
diagnostic
icon = 'computer.dmi'
icon_state = "diagnostic"
name = "diagnostic"
density = 1
var
pow = 3 // I want this to go down
proc() // error bad proc?
diagnostic(src.pow -=1)

verb/run_a_level_three_diagnostic()
set src in oview(1)
if (src.pow == 2)
usr << ""
else
usr << ""
verb/run_level_one_diagnostic()
set src in oview(1)
if (src.pow == 3)
usr << ""
else
usr << ""

computerwarp
icon = 'computer.dmi'
icon_state = "warppower"
name = "warp control"
density = 1
verb/warp_control()
set src in oview(1)
switch(input("")in list("",""))
if("")
diagnostic()//proc
usr << ""
if("")
usr << ""
usr << ""

I took out the messages to make it simpler.
you can see I tried adding a proc. I want a list to pop up and when you pick one of the options the diagnostics var/pow goes down 1 thats all lol I thought this would be really simple but its the toughest thing so far.
In response to Treasurecat
You did not define your proc correctly. A proc is defined pretty much like a verb.

proc
blah()
world << "blah blah blah"

You are also trying to use the diagnostic() proc by itself. However, you defined that proc to be used with diagnostic vars. Assuming we have an obj/diagnostic called od, you would use:

od.diagnostic()

Other than that, you still have the main problem of not having access to the diagnostic. You did the same thing you did the first time. You defined something but you have no somethings existing to act on. obj/diagnostics are defined as you say, but there are no obj/diagnostics. You formed a group which will act a certain way, but there are no members of that group to act. Yes, I'm trying to say the same thing different ways.

Either redesign or pass an obj/diagnostic to the obj/computerwarp somehow.

PS: bedtime :)
In response to ACWraith
well if it cant be done it cant be done thanks anyway im going to add a pow var to user and if I ever find out how to do what I wanted I will switch it.

thank you
In response to Treasurecat
Where did ACWraith say it can't be done? He tried to explain several different ways that it can... let me see if a fresh angle helps.

Thing You're Not Quite Grasping:
obj/diagnostic is a type, what you might call an archetype or class of object. It is NOT an instance of the object itself, but rather the idea of that object. If you want code to interact with a diagnostic, you need to have a way of referring to that particular instance.

Now, the way you would refer to that particular instance depends on context. How do you want the computer to decide which diagnostic it should be interacting with? If the diagnostic is always going to be in the same room as the other object, and there's never going to be more than one diagnostic in the same room, you can use a simple line of sight check. Put this code near the top of your proc or verb which needs to interact with the diagnostic:

var/obj/diagonstic/d //Define a variable and let the compiler know it's going to refer to a diagnostic!
for (d in oview()) //normally used to loop through all objects in a list, in this case oview(), which would fit in a variable
break //we only need to find one diagnostic, so let's stop there!

From that point on in the code, the variable d refers to your diagnostic. d.pow refers to the pow variable of that particular diagnositc. d.name refers to that diagnostic's name. d.density refers to that diagnostic's density. d.opacity refers to that diagnostic's luminosity. No, it doesn't. Just checking to see if you're paying attention.