In response to Dagolar
Dagolar wrote:
Looks good, but I get two errors and a warning:

-O:undefined type: O
-O.Look:undefined type: O.Look


-O :warning: variable defined but not used

Worked good on my side when I tested it. The only thing I could think of to cause these errors is if you changed

obj
Tomb

to someething else which would make O have an undefined type.
In response to Theodis
Your right. I had changed the name of Tomb to something more specific (Tomb_of_SoAndSo) and didn't bother changing the rest. Thanks.

-Dagolar
In response to Dagolar
Dagolar wrote:
Your right. I had changed the name of Tomb to something more specific (Tomb_of_SoAndSo) and didn't bother changing the rest. Thanks.

-Dagolar

Anyway a better way of handling the situtation would be to use object oriented programming to your advantage and do something like.

obj
{
var
{
lookMessage = ""
}

verb
{
Look()
{
if(lookMessage)
usr << lookMessage
}
}
}

client
{
Center()
{
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.Look()
}
}

obj/TheSuperSword
lookMessage = "You see a super cool sword!"
obj/SlimeMold
lookMessage = "You see a tasty looking slime mold!"


This way you can easily add look messaged to all your objects. And if you don't want an object to have a look message just leave the variable as "".
In response to Theodis
That's perfect. Thank you very much.

-Dagolar
In response to Dagolar
I used the following code:

client
Center()
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.NPCcom()
O.NPCinn1()
O.NPCinn2()

Now, NPCinn1 and NPCinn2 are two different verbs, differently defined and so forth. Now, when I center on an object that has the NPCinn1 verb attached to it, it also runs the NPCinn2 verb, even though it's not attached. Why is this happening?

-Dagolar


In response to Dagolar
Dagolar wrote:
I used the following code:

client
Center()
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.NPCcom()
O.NPCinn1()
O.NPCinn2()

Now, NPCinn1 and NPCinn2 are two different verbs, differently defined and so forth. Now, when I center on an object that has the NPCinn1 verb attached to it, it also runs the NPCinn2 verb, even though it's not attached. Why is this happening?

If it's letting you compile with that code then you have NPCinn2 defined for all objs so it is attached. The best way to handle this situtation is to rework the code a bit to let the Center() key handle more cases.

obj
var
lookText
proc
CenterAction(mob/M)
{
if(lookText)
M << lookText //The default Center action will be to show the look text if there is any.
}

obj/Person
CenterAction(mob/M)
{
Talk(M) //Overide the default action for a person object and have them talk instead.
}

proc/Talk(mob/Who)
{
View(src) << "[src]: Hello [Who]!"
}

obj/Inn
CenterAction(mob/M)
{
GoToSleep(M) //Overide the default action for an inn and have the mob sleep
}

proc/GoToSleep(mob/Who)
{
Who << "About time I got to bed!"
}

obj/Monster
CenterAction(mob/M)
{
Kill(M) //Overide the default action for a monster
}

proc/Kill(mob/Who)
{
View(src) << "[src]Arghh! Curse you [Who] you've killed me!"
del(src)
}
client
Center()
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.CenterAction(src)

In response to Theodis
client
Center()
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.NPCcom()
O.NPCinn1()
O.NPCinn2()


THIS is what the code looks like... [;\

-Dagolar
In response to Dagolar
client
Center()
var/turf/T
var/obj/O
T = get_step(mob,mob.dir)
if(T)
for(O in T)
O.NPCcom()
O.NPCinn1()
O.NPCinn2()


THIS is what the code looks like... [;\

What's wrong with it :P?
In response to Theodis
Same problem as before:

Now, NPCinn1 and NPCinn2 are two different verbs, differently defined and so forth. Now, when I center on an object that has the NPCinn1 verb attached to it, it also runs the NPCinn2 verb, even though it's not attached. Why is this happening?


When I showed it to you before, O.NPCinn2 was tabbed far to the right. It's supposed look just like I showed the second time under "New Problem".


-Dagolar

In response to Theodis
In response to Dagolar
Now, NPCinn1 and NPCinn2 are two different verbs, differently defined and so forth. Now, when I center on an object that has the NPCinn1 verb attached to it, it also runs the NPCinn2 verb, even though it's not attached. Why is this happening?

What do you mean attached? If you defined each of them under two different objects you would get a compiler error and have nothing run at all. So from what you showed I can't really figure what's going on. You need to show where your verbs are defined and how they're defined.
Page: 1 2