Docs


Launch a World logged in

This combines two concepts:
  1. A World that launches another World.
  2. The need for both Worlds to be 'logged in'. Logged in runs can do things like save data to the server.

To run a World 'logged in' you have to launch it from certain pages.
So how can a World launched by another World be logged in?

First, the parameters needed for a World to be logged in are:

 
 AB.worldid  
 AB.myuserid  
 AB.dataticket
So the plan is as follows. World 1 sets up a link to a run of World 2 with these parameters as extra arguments to be passed to run.php:
 
 var url = 'run.php?args&w=' + AB.worldid + '&u=' + AB.myuserid + '&d=' + AB.dataticket;
 // write a link with this URL for the user to click:
 AB.msg ( '<a href=' + url + '>click here</a>' );
When World 2 runs, these arguments go into variables. World 2 code can then set variables as follows:
 
 AB.runloggedin	= true;       
 AB.worldid     = AB_arg_w;    
 AB.myuserid    = AB_arg_u;
 AB.dataticket  = AB_arg_d;
Note it sets AB.worldid to pretend to be World 1. It needs to pretend to be World 1 or the data ticket will not work. But if it sets AB.worldid, and is on the same IP, then the data ticket will work.

World 2 can now save data to the server. Data will be saved to World 1's space. World 1 has basically delegated its authority to World 2.