ID:171817
 
Ok, I tried my best to switch the client's view to the racer he bet on. But Instead the screen just goes all flickery.

        for(var/mob/player/P in world)
if(P.bet == "black")
P.client.eye = locate(Bx)
if(P.bet == "blue")
P.client.eye = locate(Blx)
if(P.bet == "grey")
P.client.eye = locate(Gx)
if(P.bet == "green")
P.client.eye = locate(Grx)
if(P.bet == "red")
P.client.eye = locate(Rx)
if(P.bet == "yellow")
P.client.eye = locate(Yx)
SwitchSpeed()


The variables are defined like this:

var/mob/black_squirrel/Bx


I'm probably doing something horribly wrong XD Please point out anything I messed up. thanks!
You don't need the locate(). Also, you need to change the perspective variable.
In response to Garthor
Okay, I've looked up perspective in the reference. How should I change it? x.o sorreh for being an idiot again
In response to Rippy
Just like you would change anything else. It is a variable belonging to clients, so client/perspective=EYE_PERSPECTIVE would work just fine.
In response to Loduwijk
Ok, I've removed locate and added client/perspective=EYE_PERSPECTIVE to the code. No errors, but no luck. The client's eye doesn't follow the mob I want it to.
In response to Rippy
You do still use the variable, don't you? He said you didn't need locate, not that you didn't need the entire line.

Good
eye=variable

Bad
eye=locate(variable)
In response to Loduwijk
for(var/mob/player/P in world)
if(P.bet == "black")
P.client.eye = Bx


Yep.
In response to Rippy
*bump* So, anything wrong with it?
In response to Rippy
Try putting a bunch of debug outputs into it. Specifically, world.log<<P.bet and world.log<<P.client.eye at the end of the code block for the for-loop so you can see what the bet variable is set to at that moment and if client.eye really is not changing.

When you say the eye does not follow the object around, what do you mean? Does it not move anywhere, does it move to the object but stay put and let the object move off, does it go black? What does the eye do instead of following the object?
In response to Loduwijk
Ok, I'll try that out.

What happens is that the screen will flicker black sometimes, and the eye does absolutely nothing.

Edit: I used what you specified. The bet works fine. But it marks the eye as nothing. (and just so you know, it's a mob not an object that I'm using)
In response to Rippy
It is strange, the same thing happenes to me whenever I try to use client.eye. Maybe the error lies somewhere else and not in your code.
In response to Rippy
Rippy wrote:
What happens is that the screen will flicker black sometimes, and the eye does absolutely nothing.

It flickers sometimes? What happens all the other times?

Edit: I used what you specified. The bet works fine. But it marks the eye as nothing. (and just so you know, it's a mob not an object that I'm using)

What do you mean by "The bet works fine." Is it stating that the bet is exactly what you have in the if statements in your code? Make sure it is exact, including case.

Actually, it is an object since everything is an object. Objects of type /obj merely have their object type similar to a word used in object-oriented programming terms. Mobs are an object of type /mob, objs are an object of type /obj.
In response to Loduwijk
Ah, I see. I tend to confuse obj with object alot x.o Anyways, what I mean by sometimes is that it flickers irregularly. It'll be flickering 5 times per second one moment, and one time per second the next (approximately, I didn't count it o_o). And yes, the bet is exact down to the case. Sorry, I should have been more specific.