Avatar Selection Question

7 years 7 months ago #2078 by rico87

Ive been using this component for quite a while now, i have a maybe stupid question about it,

I started developing a webinterface using jOpenSim which is not bound to joomla, however i wonder which mysql tables need to be copied for the default appereance, and if i could Maybe get a sample code?

Regards and have a nice day


Please Log in or Create an account to join the conversation.

7 years 7 months ago #2079 by foto50
Hi rico

At jOpenSim, I basically create a special account as default account and then during registration copy all inventory folders/items from the robust database tables "inventoryfolders" and "inventoryitems" with new UUID's for the new user. My code still needs some optimization, but since all the component is open source, you can easy investigate ... specially the plugin jOpenSimRegister as well as the main class of the component (opensim.class.php).

I currently am very curious about the opensim tools published by JustinCC ( github.com/justincc/opensimulator-tools/...ster/integration/php ) but not got the time to investigate those closer yet ;) Maybe there is also something u can go on with.


Please Log in or Create an account to join the conversation.

7 years 7 months ago #2081 by rico87
Hello Foto50

i figured it out now by studying plg_jopensim_register, but because i am using the createuser account on robust i had to do a additional step.

i post my testing code here which i copied from the plugin and adjusted to work without joomla for anyone who is interested :-)
include "open_config/config.php";
function GUID()
    if (function_exists('com_create_guid') === true)
        return trim(com_create_guid(), '{}');

    return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));

function CreateUser($ip,$port,$firstname,$lastname,$password,$email,$avatar)

$uuid = GUID();
$url = "http://$ip:$port/accounts";
$myvars = "METHOD=createuser&FirstName=$firstname&LastName=$lastname&Password=$password&Email=$email&PrincipalID=$uuid";
$user = $uuid;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );
if (strpos($response,'Failure') !== false) {
    echo 'Failed to Create Account';
$new = sprintf("DELETE FROM Avatars WHERE PrincipalID='%s'",
$tt = mysql_query($new);

	$query2 = sprintf("INSERT INTO Avatars SELECT '%s' AS PrincipalID, Avatars.`Name`, Avatars.`Value` FROM Avatars WHERE Avatars.PrincipalID = '%s'",
                $test2 = mysql_query($query2);
		$query = sprintf("UPDATE Avatars SET Avatars.`Value` = '%1\$s' WHERE Avatars.PrincipalID = '%1\$s' AND Avatars.`Name` = 'UserID'",
                $test = mysql_query($query);
echo "User Account $user Resident Created<br>You can now Login";
The following user(s) said Thank You: Dayna Bedrosian

Please Log in or Create an account to join the conversation.

Time to create page: 0.142 seconds


Donate jOpenSim

Please consider supporting our efforts.


Our Regions

Region: Loc X: Loc Y:
Agora 1000 998
Bay Sho… 997 1003
BoraBor… 1002 999
Canary … 997 999
Crystal… 1001 1000
DeepTho… 1005 998
FoToSan… 996 995
jCity 1001 997
jOpenWe… 1000 999
JuniorT… 1002 1001
Kanadah… 1002 1000
LindaKe… 1000 997
MonteSc… 1001 1001
Naos 999 999
Pangaea 1005 1003
RiverSi… 999 1000
Sakani 999 998
Snambin 1001 998
ViewerH… 1002 998
WaterWo… 1001 999
WilderK… 1000 1000