ID:263012
 
Code:
mob/proc/teleport(A as text)
for(var/area/teleports/T in world)
if(T.Tagto==A)
world<<"<small>\red We have located a teleport for you.</small>"
src.loc=locate(T.loc)
return 1
return 0


Problem description:
This blackscreenes me, I went on Converse last night and asked around and no one seemed to know the "correct" way to move to an area.

Anyone have any ideas?

(Sorry to clutter the forum with such a simple problem, brain dead right now.)
An area cannot be contained by something so T.loc is null. That's nowhere on the map. I assume a teleport area is one tile.
src.loc = locate(T.x,T.y,T.z)//relocate to the turf at the areas coordinates

In response to SJRDOZER
Now when I step on the teleporter, it finds it (We have located a teleport for you.) yet nothing else happens.

area/teleports/
var/Tagto
var/Tag
t1_01
Tagto="t1_02"
t1_02
Tagto="t1_01"
t1_03
Tagto="t1_04"
t1_04
Tagto="t1_03"
Entered(mob/player/M)
..()
if(!M.teleport(Tagto))world.log<<"<B>Failed to teleport [M] to [Tagto].</B>"
In response to Flame Sage
What I gave you last night in wiz_chat worked fine, how'd you break it?
In response to Nadrew
No it didn't, my Mom pulled the plug on me so I couldn't reply back to you saying it didn't work.
You can set the player's loc to the actual area, and the player will be located at the bottom-left most turf in the area's contents, so there is no need for locate().

~~> Unknown Person
In response to Unknown Person
Is this what you ment?
src.loc = T

(No working)
In response to Flame Sage
It worked fine in my tests.
mob
proc
Teleport(A as text)
for(var/area/T)
if(T.TagTo == A)
var/turf/teleport = locate() in T
src.loc = teleport


Works pretty good.
In response to Nadrew
Doesn't work with me. I double checked to make sure nothing was getting the way of Move(), and nothing was.

For some reason it just isn't working with me.
In response to Flame Sage
area/teleports/
icon='Turfs.dmi'
icon_state="teleports"
invisibility=101
layer=500
var/Tagto
var/Tag
t1_01_pub
Tagto="t1_02_pub"
t1_02_pub
Tagto="t1_01_pub"
t1_03_pub
Tagto="t1_04_pub"
t1_04_pub
Tagto="t1_03_pub"
Entered(mob/player/M)
..()
if(!M.teleport(Tagto))world.log<<"<B>Failed to teleport [M] to [Tagto].</B>"
mob/proc/teleport(A as text)
for(var/area/teleports/T in world)
if(T.Tagto==A)
world<<"<small>\red We have located a teleport for you.</small>"
var/turf/teleport = locate() in T
src.loc = locate(teleport.x+1,teleport.y,teleport.z)
return 1
return 0

Did I screw up on something?

I had it increase my x value just to make sure it wasn't double warping for some reason... And Now It Just Moves my X ONE over from where I stood.
Yo i use this teleport system only problem with it is that you have to make multipul turfs but i hope it helps

turf/Teleporter
icon='teli.dmi'
Entered(mob/M)
if(istype(M,/mob))
M.loc=locate(x,y,z)
In response to VolksBlade
That's not what i want.

I think it has to do something with how I named them.
Because..
area/teleports/
icon='Turfs.dmi'
icon_state="teleports"
invisibility=101
layer=500
var/Tagto
t1_01_pub
Tagto="t1_02_pub"
name="GRAVY"
t1_02_pub
Tagto="t1_01_pub"
t1_03_pub
Tagto="GRAVY"
t1_04_pub
Tagto="t1_03_pub"
Entered(mob/player/M)
..()
if(!M.teleport(src.Tagto))world.log<<"<B>Failed to teleport [M] to [Tagto].</B>"
mob/proc/teleport(A as text)
for(var/area/teleports/T in world)
if(A==T.name)
world<<"<small>\red We have located a teleport for you.</small>"
var/turf/teleport = locate() in T
src.loc = locate(teleport.x+1,teleport.y,teleport.z)
return 1
return 0

Whenever I use the warp to goes to GRAVY, it works fine.
Could it have to do with the numbers and _ inside of the name?
In response to Flame Sage
All Caps? :) When you set a layer, you can do MOB_LAYER, so underscore is alright. I guess all caps or if not, then I dunno and now too lazy to look at code.
In response to SJRDOZER
No. But I was noticing how names with a-z (noncaps) presented as the ____. SO just to be safe, I capilized the first letters, but still nothing.

area/teleports/
icon='Turfs.dmi'
icon_state="teleports"
layer=500
var/TO
var/NAME
t1_01_pub
NAME="T1_01_pub"
TO="T1_02_pub"
t1_02_pub
NAME="T1_02_pub"
TO="T1_01_pub"
t1_03_pub
NAME="T1_03_pub"
TO="T1_04_pub"
t1_04_pub
NAME="T1_04_pub"
TO="T1_03_pub"
Entered(mob/player/M)
..()
M.teleport(src)
mob/proc/teleport(A as turf)
var/area/teleports/B=A
for(var/area/teleports/T in world)
if(B.TO==T.NAME)
world<<"<small>\red We have located a teleport for you.</small>"
var/turf/teleport = locate() in T
src.loc = locate(teleport.x,teleport.y,teleport.z)
return 1
world.log<<"<B>\red\<DEBUG> Failed to teleport [src] <br>from [B.NAME] to [B.TO].</B>"
return 0


<DEBUG> Failed to teleport Flame Sage
from T1_02_pub to T1_01_pub.

The stupid things are THERE! How come the for() cannot seem to find them?!
In response to Flame Sage
area/teleports/
icon='grass.dmi'
icon_state = "teleport"
invisibility=101
layer=500
var/Tagto
t1_01_pub
Tagto = "T1_02_PUB"
t1_02_pub
Tagto = "T1_03_PUB"
t1_03_pub
Tagto = "T1_04_PUB"
t1_04_pub
Tagto = "T1_03_PUB"
var/Name
t1_01_pub
Name = "T1_01_PUB"
t1_02_pub
Name = "T1_02_PUB"
t1_03_pub
Name = "T1_03_PUB"
t1_04_pub
Name = "T1_04_PUB"
Entered(var/mob/players/M)
..()
M.teleport(src.Tagto)
mob/players/proc/teleport(A as text)
for(var/area/teleports/T in world)
if(A==T.Name)
usr<<"Teleporting you to [T.Name]."
usr.loc = locate(T.x,T.y,T.z)


Thank you for teaching me how to do teleports :D
In response to Flame Sage
Flame Sage wrote:
Did I screw up on something?

Indeed you did. By default, an atom's name will be the type path (excluding whatever is before the last '/'), except that all of the underscores (_) are replaced with spaces. The way you are identifying the spaces is by looking at the area's name, but your comparisons have underscores in them. Therefore:

    t1_01_pub
Tagto="t1_02_pub"


Should work as this:

    t1_01_pub
Tagto="t1 02 pub"


I would much rather suggest you check for type paths, since that's one extra variable you don't have to keep track of (since it's unique).

    t1_01_pub
Tagto=/area/teleports/t1_02_pub


~~> Unknown Person
In response to Unknown Person
My code worked just fine. When I teleported and said to tell me that I teleported to T.Name, it said T.Name with underscores.
In response to SJRDOZER
SJRDOZER wrote:
My code worked just fine. When I teleported and said to tell me that I teleported to T.Name, it said T.Name with underscores.

Of course yours it did work, because I wasn't talking about the "Name" variable you defined yourself, but the default name variable that all atomic objects are predefined with.

~~> Unknown Person
In response to Unknown Person
Unknown Person wrote:
SJRDOZER wrote:
My code worked just fine. When I teleported and said to tell me that I teleported to T.Name, it said T.Name with underscores.

Of course yours it did work, because I wasn't talking about the "Name" variable you defined yourself, but the default name variable that all atomic objects are predefined with.

~~> Unknown Person

Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhh