Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-10-2016, 07:16 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
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)); 
Reply With Quote
  #2  
Old 07-10-2016, 09:00 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #3  
Old 07-10-2016, 10:25 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko has a spectacular aura aboutKirko has a spectacular aura about
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

Last edited by Kirko; 07-10-2016 at 10:54 PM.. Reason: dun goofed
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:48 PM.


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