Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   object -> XML (https://forums.graalonline.com/forums/showthread.php?t=74337)

Inverness 06-03-2007 11:07 PM

With the introduction of GS2 its not good to put dots in clientr flags since GS2 its like changing scope I guess you could say, the engine reads it as in different object.

Deadly_Killer 06-04-2007 07:16 AM

Quote:

Originally Posted by Inverness (Post 1314787)
With the introduction of GS2 its not good to put dots in clientr flags since GS2 its like changing scope I guess you could say, the engine reads it as in different object.

First one returns client / clientr. Second one digs one level deeper to return clientr.something = hi

Skyld 06-04-2007 09:06 AM

Quote:

Originally Posted by JkWhoSaysNi (Post 1314210)
and sample output for a player object:

PHP Code:

<?xml version="1.0" encoding="iso-8859-1"?>
<JkWhoSaysNi>
  <account>JkWhoSaysNi</account>
  <ani>hoverboardidle</ani>
  <aniparams></aniparams>
  <ap>100</ap>
  <arrows>5</arrows>
  <attached>false</attached>
  <attachid>0</attachid>
  <attachtype>0</attachtype>
  <attr>
    <index id="0"></index>
    <index id="1"></index>
    <index id="2"></index>
    <index id="3"></index>
    <index id="4"></index>
    <index id="5"></index>
    <index id="6"></index>
    <index id="7">-1</index>
    <index id="8">0</index>
    <index id="9">dn_space_name3.gani</index>
    <index id="10">-6.2681853</index>
    <index id="11">0</index>
    <index id="12">0</index>
    <index id="13">0</index>
    <index id="14"></index>
    <index id="15"></index>
    <index id="16"></index>
    <index id="17"></index>
    <index id="18"></index>
    <index id="19"></index>
    <index id="20">1</index>
    <index id="21">1</index>
    <index id="22"></index>
    <index id="23"></index>
    <index id="24"></index>
    <index id="25"></index>
    <index id="26"></index>
    <index id="27"></index>
    <index id="28"></index>
    <index id="29"></index>
    <index id="30"></index>
  </attr>
  <body>body10.png</body>
  <bodyimg>body10.png</bodyimg>
  <bombs>10</bombs>
  <canspin>false</canspin>
  <carriesblackstone>false</carriesblackstone>
  <carriesbush>false</carriesbush>
  <carriesnpc>false</carriesnpc>
  <carriessign>false</carriessign>
  <carriesstone>false</carriesstone>
  <carriesvase>false</carriesvase>
  <chat></chat>
  <colors>
    <index id="0">darkblue</index>
    <index id="1">black</index>
    <index id="2">darkblue</index>
    <index id="3">darkblue</index>
    <index id="4">darkblue</index>
    <index id="5">black</index>
  </colors>
  <computerfirstlogin>0</computerfirstlogin>
  <darts>5</darts>
  <deaths>4</deaths>
  <dir>2</dir>
  <fullhearts>3</fullhearts>
  <glovepower>1</glovepower>
  <graalversion>4.2</graalversion>
  <gralats>0</gralats>
  <guild>scriptering</guild>
  <head>head86.png</head>
  <headimg>head86.png</headimg>
  <headset>-1</headset>
  <hearts>3</hearts>
  <horseimg></horseimg>
  <hp>3</hp>
  <id>6</id>
  <initialized>false</initialized>
  <isfemale>false</isfemale>
  <ismale>true</ismale>
  <ispaused>false</ispaused>
  <joinedclasses></joinedclasses>
  <kills>0</kills>
  <language>English</language>
  <languagedomain>en</languagedomain>
  <lastdead>39935339</lastdead>
  <level>
  <board></board>
  <height>64</height>
  <initialized>false</initialized>
  <isnopkzone>false</isnopkzone>
  <ispaused>false</ispaused>
  <issparringzone>false</issparringzone>
  <joinedclasses></joinedclasses>
  <maxlooplimit>10000</maxlooplimit>
  <name>osl3.nw</name>
  <npcs>
    <index id="0">Knight/Test</index>
  </npcs>
  <players>
    <index id="0">JkWhoSaysNi</index>
  </players>
  <projectiles>
  <initialized>false</initialized>
  <ispaused>false</ispaused>
  <joinedclasses></joinedclasses>
  <maxlooplimit>10000</maxlooplimit>
  <name>projectiles</name>
  <scriptlogmissingfunctions>false</scriptlogmissingfunctions>
  <timeout>0</timeout>
  </projectiles>
  <scriptlogmissingfunctions>false</scriptlogmissingfunctions>
  <tilelayercount>1</tilelayercount>
  <tilelayers>
    <index id="0"></index>
  </tilelayers>
  <tiles>
  <initialized>false</initialized>
  <ispaused>false</ispaused>
  <joinedclasses></joinedclasses>
  <maxlooplimit>10000</maxlooplimit>
  <name>obj</name>
  <scriptlogmissingfunctions>false</scriptlogmissingfunctions>
  <timeout>0</timeout>
  </tiles>
  <timeout>0</timeout>
  <width>64</width>
  </level>
  <logintime>39935339</logintime>
  <maxhp>3</maxhp>
  <maxlooplimit>10000</maxlooplimit>
  <movementlimit>10001</movementlimit>
  <mp>0</mp>
  <name>JkWhoSaysNi</name>
  <nick>Knight (scriptering)</nick>
  <onlinetime>106524</onlinetime>
  <pause>false</pause>
  <paused>false</paused>
  <platform>win</platform>
  <playersindex>0</playersindex>
  <rating>1500</rating>
  <ratingd>350</ratingd>
  <rupees>0</rupees>
  <scriptlogmissingfunctions>false</scriptlogmissingfunctions>
  <shield>no-shield.gif</shield>
  <shieldimg>no-shield.gif</shieldimg>
  <shieldpower>1</shieldpower>
  <sprite>0</sprite>
  <sword>sword1.gif</sword>
  <swordimg>sword1.gif</swordimg>
  <swordpower>1</swordpower>
  <timeout>0</timeout>
  <trial>false</trial>
  <upgradestatus>vip</upgradestatus>
  <version>4.2</version>
  <weapons>
    <index id="0"></index>
    <index id="1">ServerConnect</index>
    <index id="2">-Player System</index>
    <index id="3">*Player/Tailor</index>
    <index id="4">*Staff/Admin Tool</index>
    <index id="5">*Staff/Boots</index>
    <index id="6">*Staff/Tag</index>
    <index id="7">-lavadamage</index>
    <index id="8">Hoverboard</index>
    <index id="9">*Staff/Summon</index>
    <index id="10">*ServerConnect</index>
    <index id="11">-MessageSys</index>
    <index id="12">flamethrower</index>
    <index id="13">wavemaker</index>
    <index id="14">Knight/Test</index>
  </weapons>
  <x>35.5</x>
  <y>21</y>
  <z>0</z>
</JkWhoSaysNi>

I intend to make a XML->Object function too. :)

In valid XML, normally you should have a root container key (for example, let's say <objects>[...]</objects>) to store all your objects in.

Secondly, it doesn't make sense to have your keys named <JkWhoSaysNi>[...]</JkWhoSaysNi>, etc; that just makes it more difficult for an interpreter. Just use a uniform tag name for each object like <object>[...]</object> (the data needed to identify the key is already in your XML tree, and it sometimes makes it easier for interpreters, also makes it possible to render your data in a web browser using XSL or such).

Other than those minor tweaks, it's a nice script.

JkWhoSaysNi 06-04-2007 03:12 PM

<JkWhoSaysNi> is the root key :P

But you're probably right, just using <object> would be better.

I actually wanted to get the object in-game name for that. Such as "player" so it would be <player>...</player>

but I don't know how to get "player" from the object.. and as far as I know there's no way of getting it.

Skyld 06-04-2007 04:02 PM

If TServerPlayer is sufficient, then use obj.objecttype().


All times are GMT +2. The time now is 01:14 PM.

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