ID:140913
 
Code:
      switch(input("Where would you like to Teleport to?", text) in list ("Earth","Hueco Mundo","Cancel"))
if("Earth")
new/turf/tele/tele1(usr.loc)
spawn(20)
del src
if("Hueco Mundo")
new/turf/tele/tele2(usr.loc)
spawn(20)
del src


Problem description:
The code is supposed to allow a player to summon a portal at their location
and if anyone walks in it they will be taken to the location picked by the owner of the portal

that part of the code works
the problem now is to get it to delete it self after a certain ammount of time

help would be greatly appreciated


One problem I see is that if you summon a turf to replace a turf, then delete the summoned turf, the original turf will be replaced by whatever your world's default turf is (or nothing, if you don't have one). So you either need to summon an object that goes on top of the turf, or you need to give the turf an overlay instead of replacing it.

As for removing it after a period of time, the way you have it setup should work fine except you need an extra tab before the "del src" so that it happens after the spawn() times out:

var/obj/O = new(location)
spawn(20)
del(O)
In response to Foomer
I understand what you mean about the turf being replaced
but could you explain the code a bit to me
I'm very new to coding