ID:268574
 
client
Center()
for(var/client/C)
for(var/obj/Interactive/I in oview(1))
I.Interact()
obj
Interactive
pie
proc/Interact()
usr << "I like pie. <3"

=/
Is there ANYWAY to make it go odown to EVERYTHING in the branch Interactive?

My problem:
Centerkey Test.dm:5:error:I.Interact:undefined proc
Thus, meaning, it doesn't go down to everything in the branch. Is there a way to do that?
obj
Interactive
proc/Interact(var/mob/M)

pie
Interact(var/mob/M)
M << "Mmm.... pie...."
In response to Jon88
Thank you, very much!
[Edit]Hmmm... isn't working =/ Thanks for the help, so far.
In response to Hell Ramen
In what way isn't it working?

Lummox JR
In response to Lummox JR
Erm, the center key isn't doing anything. =/
Thanks for helping.
In response to Hell Ramen
Hell Ramen wrote:
Erm, the center key isn't doing anything. =/

Doubtless it won't, unless you define client/Center() to do something.

Lummox JR
In response to Lummox JR
_>
Aren't I already defining it?
client
Center()
for(var/client/C)
for(var/obj/Interactive/I in oview(1))
I.pie(src)//send the proc information about who to send the "pie" message to, in this case src.

obj/Interactive
proc/Interact(var/mob/M)//the proc requires a mob to work, in the above we sent it src. So it makes src a variable called M in this proc.
M << "pie"
pie
icon = 'pie.dmi'


This should work fine considering you hit the key 5(center) on the right hand side of your keyboard with numslock off.

I THINK your problem before was that you're calling a proc for ALL Interactive objs, and defined the proc for only ONE of them(pie). Which is why it gave you an error.
In response to DeathAwaitsU
Soo, I have to keep making new ones for each object? x_x
In response to Hell Ramen
No. You make it once, for obj/Interactive. Then you can override it for subtypes of obj/Interactive, like this:

obj/Interactive
proc/Interact(var/mob/M)
M << "You just interacted with [src]"

pie
// This next bit is called "overriding" Interact().
// Note that you don't need the word "proc" this time.
// (In fact, if you do put "proc" in, it'll give you an error.)
Interact(var/mob/M)
M << "You eat a pie. Mmmn, pie."

pizza
// Similar thing here
Interact(var/mob/M)
M << "Pizza! YUM!"

icecream
// You don't have to override Interact().
// For example, this type (/obj/Interactive/icecream)
// doesn't bother.

spinach
Interact(var/mob/M)
M << "Ewww, spinach."


...and so on.
In response to Crispy
Hmm... what happens if I go...
I_pizza
name = "Pizza"
And stuff like that...?
In response to Hell Ramen
What?
In response to DeathAwaitsU
   icecream
// You don't have to override Interact().
// For example, this type (/obj/Interactive/icecream)
// doesn't bother.

Right there, I'm suspecting "Interact/I", works for everything that starts with "I".
So, I_Pizza would work, wouldn't it...?
In response to Hell Ramen
Do you mean for(var/obj/Interact/I) works for everything that starts with the letter I?

If so then no...


That just means create a variable I for everything that comes under the category obj/Interact

obj
Interact
Pie
icon = 'pie.dmi'
Pizza
icon = 'pizza.dmi'
Cake
icon = 'cake.dmi'


If you do for(var/obj/Interact/I), it means Pie, Pizza and Cake are now defined as a variable.

You can do the same for EVERY obj...

for(var/obj/O in world)

obj
Clowns
icon = 'clown.dmi'
Sword
icon = 'sword.dmi'
Armour
Body_Armour
icon = 'barmour.dmi'
Helmet
icon = 'helmet.dmi'
Legs
icon = 'larmour.dmi'


All the obj's there(Clowns, Sword and all the Armours) are now a variable called O.