ID:179493
 
Is there a way to call a procedure from inside a procedure that is on a different mob? I would like to do this:

mob
arrival
player

mob/arrival
SampleProc()
[various code here]
Mobassign() //Changes the user from the arrival mob
//to the player mob, this procedure is
//located on /mob/arrival, so it works
//fine
Craetechar()//This is where I have problems. This
//procedure is located on /mob/player, so
//calling it from SampleProc(), it tells
//tells me it's a bad proc. It needs to be
//on /mob/player because I have just
//changed the user from an arrrival to a
//player. I do this for savefile purposes

If this doesn't make enough sense, I can scrap this message and just post the ideas behind my project and ask for advice.

-- John

Well, since there has been a lull in the postings, I will go ahead and take the time to explain what I would like to do here. When a name has been typed in that is not found in the player files (ah yes, remember that we are currently existing in the /mob/arrival/Login() proc), the program should then switch the user's mob to /mob/player and then run the Createchar() proc to begin assigning important properties to the player.

I know one solution would be to put all of my logging and character creating procedures straight onto the /mob and forget the whole /mob/arrival. Would that be inneficient coding, or is that my only solution?

Again, since there is a lull in the posting, I am going to be more long-worded here, I seem to have the time. Here is my actual step by step, character log-in sequence. Anyone who would like to throw ideas at me is about to become a best friend:

1 A name is asked for
2 Checks to see if name is in database
FALSE (they are not in the database)
3 Asks if name was correctly typed
FALSE (They say 'NO' I mistyped it)
4 Return to step 1
TRUE (They say 'YES' I typed it correctly)
4 Assigns the name
5 Prompts them for a password (and assigns it)
6 Prompts them for a gender (and assigns it)
7 Prompts them for a Job (and assigns it, icon, and title)
9 Displays a New User welcome
10 Logs them in and announces them to everyone
TRUE (they are in the database)
3 Asks for password
FALSE (password was incorrect)
4 Explain the password was incorrect
5 Return to step 1
TRUE (password was correct)
4 Character is retrieved and they are logged in as normal

There is the log-in sequence which is the source of all my recent posts :-P Anyone who wants to either answer the original question of the topic, OR this specific post, please feel free.

-- John

In response to Felegar
You can call other procs by using the call proc.
call(Object,ProcName)(Arguments)

It's briefly explained in the F1 help in byond. I never really used it so I don't know that much about it, supposedly you can call any proc by it's reference such as.
Felegar wrote:
Is there a way to call a procedure from inside a procedure that is on a different mob?

You can call the proc for any other object or mob as long as you have a reference to that object or mob.

For example:

var/mob/new_mob = new()
new_mob.SetHailText("Hail there, citizen!")
In response to Deadron
> var/mob/new_mob = new()
> new_mob.SetHailText("Hail there, citizen!")


That reminds me of WellWorld.
In response to Spuzzum
Spuzzum wrote:
> > var/mob/new_mob = new()
> > new_mob.SetHailText("Hail there, citizen!")

That reminds me of WellWorld.

Yeah there is some character stuff I want to reuse someday from that game. You'll see some fun character interaction in L&D...plus Guy has a very intriguing RPG idea that would give an opportunity for fun character stuff...