ID:168692
 
Hi everyone im trying out fora corporation and i want to gety in and to get in i need to know how to bump icons. Whats the code for opening a door walkin gin and you apear inside on a different part of the map. Like i walk in a door and teleport to a room not near the door and when i walk back i go back were door was.i woudld really aprecaite if you helped thankyou
Look up Entered()
In response to RaditzX
what are you talking about
In response to Pimpy
Enter() is for making doors, portals, or whatever you feel like.
In response to Pimpy
Pimpy wrote:
what are you talking about

#1 Open dream maker
#2 Hit 'F1'
#3 And look up Entered()

Or check the online DM-reference and look for Entered() :)

And if you really want to learn coding check out the DM-guide (the link is to the right under 'recources'), And I would recommond ZBT :).

O-matic
In response to Popisfizzy
Popisfizzy wrote:
Enter() is for making doors, portals, or whatever you feel like.

Not really, Enter shouldn't be used to much, actually only when you want an atom not being able to enter a turf/area or the opposite.

If you use Enter() for a door then you're doing it baaad, veeeery baaad.
Allow me to explain the differences:

Enter()-
The procedure when an atom/client tries to enter a turf/area

Entered()-
When an atom Entered the turf/area; so basically the procedure after Enter()


O-matic

In response to O-matic
If the only difference is that you go in the turf, then move compared to you just try and enter and get moved, then I prefer Enter().
In response to O-matic
I disagree.
Why call the Entered() func. after you have entered to door?
It makes no sense to call a proc (Entered) after you enter the turf.(Thats pretty useful for doors In my opinion --unless your closing them) but for opening a door/portal and other such means of transportation/location Id say that the Enter would work just find.For instance heres a little of StepByond script:

/**nonCopyright (c) 2005 Itanium
*Includes an Entering Example as used in the
*StepByond lib/demo.
**/

turf/Door
{
density=1
proc/Open()
{
/*run everything*/
};
};

Okay trusting that you know that if a movable atom is unable to proceed into a new turf that means that the Turfs Enter Func. returned 0.
In StepByond closed doors had a density of one and had a func. called 'Open'.Open could be accessed through the statpanel the mouse and another way by bumping into the door.Thats because the door had a Bumped func.Wich is called when that atom is bumped.And by default for the door to be bumped,the it must return 0 for its Enter func. when the atom calls it.

Itanium
In response to Itanium
Itanium wrote:
I disagree.
Why call the Entered() func. after you have entered to door?
It makes no sense to call a proc (Entered) after you enter the turf.

Then why call Enter()? There has been quite a few discussions about this subject in the past, maybe do a forum search and you'll find some of them.


However, here's a little explanation:

Enter() is the procedure when an atom tries to enter a turf/area, obvious. So I don't see any reason to use Enter() as a teleport function; it should be only used to prevent an atom from entering a specific turf/area, or the opposite.

turf/A
Enter(mob/M)
if(ismob(M))
M <<"Tested!"


So if an atom enters the turf 'A', he'll get the message "Tested!". Works fine, nothing wrong. But why give the message to the mob while he's still entering the turf? Why? Same as for teleports, Why teleport the mob while he's still entering? Why not while already entered the turf? I want one good reason from why using Enter() is better.


turf/A
Entered(mob/M)
if(ismob(M))
M.loc=locate(1,1,1)
M <<"You entered [src]!"


That's the good way of doing it for an teleport.

And most people when they're walking (in DS of course) they don't hit an arrow one by one, but they hold it down. What I mean is that they actually run into the turfs. So if I used Enter() in the code above the mob wouldn't get the message ("M <<"You entered [src]!") once, but twice, or more times..

I just hope you read these words very carefully..

O-matic
In response to O-matic
O-matic wrote:
Enter() is the procedure when an atom tries to enter a turf/area, obvious. So I don't see any reason to use Enter() as a teleport function; it should be only used to prevent an atom from entering a specific turf/area, or the opposite.

> turf/A
> Enter(mob/M)
> if(ismob(M))
> M <<"Tested!"
>

So if an atom enters the turf 'A', he'll get the message "Tested!". Works fine, nothing wrong.

No, you would have to return something true or else the mob wouldn't actually be able to enter the turf. You only should use Enter() if you want to disallow something from going onto the turf/area. Entered() should be used to do something when something successfully enters the area.

I understand that it wouldn't matter that much if you use Enter(), since the guy would be teleported anyway, but it would be more obvious to use Entered(), since you do not need to restrict movement to the turf.

You could do every which way you want, because both ways work fine, but if you use Enter(), you could be restricted to movement if the object could allow movable atomsin, and warp them, or not allow them in, and do something else.

~~> Dragon Lord
In response to Unknown Person
Unknown Person wrote:
O-matic wrote:
Enter() is the procedure when an atom tries to enter a turf/area, obvious. So I don't see any reason to use Enter() as a teleport function; it should be only used to prevent an atom from entering a specific turf/area, or the opposite.

> > turf/A
> > Enter(mob/M)
> > if(ismob(M))
> > M <<"Tested!"
> >

So if an atom enters the turf 'A', he'll get the message "Tested!". Works fine, nothing wrong.

No, you would have to return something true or else the mob wouldn't actually be able to enter the turf. You only should use Enter() if you want to disallow something from going onto the turf/area. Entered() should be used to do something when something successfully enters the area.

~~> Dragon Lord

That was actually what I was trying to explain in the other lines- only I made a mistake in that line, sorry! And thanks for the correction.

O-matic
In response to RaditzX
Why not make it an obj, make it dense and use Bump()?
In response to Karrigo
Because then you end up checking to see whether every single bloomin' dense object wants to teleport me somewhere! Just use Entered(). Using Enter() and Bump() make no sense at all. You want to move into the location, then have it teleport you somewhere. Easy. Making it dense screws up pathfinding. Making it happen on Enter() can screw with code that would keep a person from entering a certian area.

Just do it the right way and stop this stupid discussion.