Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Get name variable from an object (https://forums.graalonline.com/forums/showthread.php?t=134270327)

Kirko 07-10-2016 07:16 PM

Get name variable from an object
 
I'm trying to get the name variable from an object but not the name variable that it thinks I'm trying to get :o

The object has a custom variable called name but when ever I echo it, it will just echo the name of the variable. this sounds confusing.. anyhow

All these echo 'c' but there's actually something assigned to temp.c.name which I'm trying to get but can't figure it out
If it helps, this data was from json which I then used loadjsonfromstring that turned it into an object.
PHP Code:

    echo(temp.c.name);
    echo(
makevar("temp.c.name"));
    echo(
temp.c.(@name)); 


fowlplay4 07-10-2016 09:00 PM

name is a built-in read-only variable which is why you're probably having issues.

use a different variable other than name in your json.

Kirko 07-10-2016 10:25 PM

I can't change the variable names but I figured I would use savevarstoarray to turn it into an array. It's sorta confusing but it's alright.

Thank you

edit: When I turned it into an array I saw the name variable was actually called xmlname :(


All times are GMT +2. The time now is 03:01 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.