ID:179220
 
I am trying to use the arrow keys to change perspective rather than control player movement.

with this code

client
perspective = EYE_PERSPECTIVE

North()
eye = locate(usr.loc.x, usr.loc.y + 1, usr.loc.z)
East()
eye = locate(usr.loc.x +1, usr.loc.y, usr.loc.z)
South()
eye = locate(usr.loc.x, usr.loc.y - 1, usr.loc.z)
West()
eye = locate(usr.loc.x - 1, usr.loc.y, usr.loc.z)

I have had limited success, I can get it to of course center one square in any direction of the player, I have not been able to figure out how to refocus on the eye, eye.x and src.loc.x and eye.loc,x are all undefined vars, and usr.loc is obviously not what I want, I have seen this work on sheep2 by Zilal.

Any hep on figuring out what to reference for the movemnt of the perspective would be greatly appreciated.

Illyena
I don't know much about it either, but I know this works:

mob/verb/look_north()
client.eye = locate(src.x,src.y+5,src.z)
Illyena wrote:
[snip]
I have had limited success, I can get it to of course center one square in any direction of the player, I have not been able to figure out how to refocus on the eye, eye.x and src.loc.x and eye.loc,x are all undefined vars, and usr.loc is obviously not what I want, I have seen this work on sheep2 by Zilal.
[snip]

If all else fails, you could just make your own x, y and z for the eye. I realize it's not the most pretty solution, but it would at least work.
In response to Foomer
Foomer wrote:
I don't know much about it either, but I know this works:

mob/verb/look_north()
client.eye = locate(src.x,src.y+5,src.z)

Right but that still refers to the Mob as the src and bases the movement of the eye off of the mobs current location, If you execute the verb it sets the eye to center 5 tiles 'north' of the users current location, but if you execute it again it will not go a further 5 tiles north, and that is what I want except for one tile at a time,

I guess I am trying to find a way to get the eye to reference it's own location and move from there., although eye is a var under client, much like mob, however the eye references the mob by name rather than location.
I tried setting client/var x y and z, to usr.loc x y and z and using that as a reference, it moves but I don't knwo to where, I have a feeling I am close to an answer but nothing is making much sense so far.
Illyena wrote:
I am trying to use the arrow keys to change perspective rather than control player movement.

with this code

client
perspective = EYE_PERSPECTIVE

North()
eye = locate(mob.x, mob.y + 1, mob.z)
East()
eye = locate(mob.x +1, mob.y, mob.z)
South()
eye = locate(mob.x, mob.y - 1, mob.z)
West()
eye = locate(mob.x - 1, mob.y, mob.z)

make use of the mob variable for a client.

Dont forget Northeast(), Northwest(), Southwest(), Southeast() too!

I have had limited success, I can get it to of course center one square in any direction of the player, I have not been able to figure out how to refocus on the eye, eye.x and src.loc.x and eye.loc,x are all undefined vars, and usr.loc is obviously not what I want, I have seen this work on sheep2 by Zilal.

Any hep on figuring out what to reference for the movemnt of the perspective would be greatly appreciated.

Illyena

Your undefined variables basically means that what you tried to type in didnt have the variable that you used. This is the reason why i used the mob "sub-variable".

FIREking
In response to FIREking
FIREking wrote:

perspective = EYE_PERSPECTIVE

North()
eye = locate(mob.x, mob.y + 1, mob.z)
East()
eye = locate(mob.x +1, mob.y, mob.z)
South()
eye = locate(mob.x, mob.y - 1, mob.z)
West()
eye = locate(mob.x - 1, mob.y, mob.z)

make use of the mob variable for a client.

Dont forget Northeast(), Northwest(), Southwest(), Southeast() too!
they are set to:
Northeast()
Northwest()
Southeast()
Southwest()

Your undefined variables basically means that what you tried to type in didnt have the variable that you used. This is the reason why i used the mob "sub-variable".

using mob.loc in place of usr.loc, does exactly the same thing in this instance. moves the eye to one tile away from the mob
Illya
In response to Illyena
where did i say mob.loc? i said mob.x + 1 or whatever.

Dont use loc! Locate(mob.x,mob.y,mob.z) will find the turf under mob! Therefore, you are locating turfs to set the eye location!

FIREking
In response to FIREking
no I used mob.x etc... and it did the same thing as when I tried usr.loc.x etc
but I tried this ...
AND I GOT SUCCESS, it isn't perfect and needs to be refined but it is working at least. if anyone can think of a way to make it function better please let me know.
client
perspective = EYE_PERSPECTIVE
var
a = 0
b = 0
North()
eye = locate(mob.x + b, mob.y + a, mob.z)
a++
East()
eye = locate(mob.x + b, mob.y + a, mob.z)
b++
South()
eye = locate(mob.x + b, mob.y + a, mob.z)
a--
West()
eye = locate(mob.x + b, mob.y + a, mob.z)
b--
In response to Illyena
Illyena wrote:
[snip]
AND I GOT SUCCESS, it isn't perfect and needs to be refined but it is working at least. if anyone can think of a way to make it function better please let me know.
[snip]

Could you define "isn't perfect" and "better"?

It looks like it is depending on the mob's location. I don't know if this is intentional. If you use North() five times, move the mob north, and then use North() again, the eye will be two north from the mob's original location instead of six. It still might be a good idea to keep the complete eye coordinates in client instead of just offsets.
In response to Illyena
Illyena wrote:
no I used mob.x etc... and it did the same thing as when I tried usr.loc.x etc

damn, messed up good that time!

Of course it would only move 1 space and no more, because your mob is still in the same place! MY BAD!

Do what acwraith suggested, and keep track of the position using your own client variables

client
var
eyex
eyey
eyez

and change those accordingly!, dont forget to set them to mob.x, mob.y, mob.z initially, or youll be screwed when you try to do any addition or subtraction!

FIREking