[Tutorial] Using y_xml to write/read xml files. [Another way to write CFG data but better]
#1

----
Reply
#2

You know what really grinds my gears?

When ****** makes includes no one even knows about.

This is one of them. - I seriously had no idea anyone even used .xml files in SA-MP but apparently ****** has produced yet another useless include.

OP: um good job i guess
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You know what really grinds my gears?

When ****** makes includes no one even knows about.

This is one of them. - I seriously had no idea anyone even used .xml files in SA-MP but apparently ****** has produced yet another useless include.

OP: um good job i guess
He developed this as its used in y_td.

And yes I know no one really uses it because they didn't know it exists.

I mean thats why I created this tutorial, lol

But it'd be a better replacement for CFG files which is used in each and every script.... As this one is more ordered and tidy...

Instead of cfg which looks like:
Quote:

1|0|Ben_Jayson|1533.928466|-1647.942260|13.382802|0|0|0|1|100|0|-25.884498|-185.868988|1003.546875|17

It will be:
Код HTML:
<XML>
  <Biz name="1">
    <IntInterior>17</IntInterior>
    <IntZ>1003.546875</IntZ>
    <IntY>-185.868988</IntY>
    <IntX>-25.884498</IntX>
    <AP>0</AP>
    <Price>10000</Price>
    <Level>1</Level>
    <Sold>0</Sold>
    <Products>91</Products>
    <Money>920</Money>
    <Z>13.553833</Z>
    <Y>-2105.518066</Y>
    <X>2421.240722</X>
    <Owner>Frank_Jones</Owner>
    <Status>1</Status>
    <Type>4</Type>
  </Biz>
</XML>
Reply
#4

The advantage of this being? I mean, isn't y_ini already creating / aiming(to create) something more organized? ****** seems to be going way over-board with his shit.
Reply
#5

Quote:
Originally Posted by Abagail
Посмотреть сообщение
The advantage of this being? I mean, isn't y_ini already creating / aiming(to create) something more organized? ****** seems to be going way over-board with his shit.
Well, XML is more like a database... An XML file is just like a table with items in it.
while in y_ini you will have to make multiple files.

For example, If you have a biz system in xml.. It'd be only 1 file for all bizs:
Код HTML:
<XML>
  <Biz name="1">
    <IntInterior>17</IntInterior>
    <IntZ>1003.546875</IntZ>
    <IntY>-185.868988</IntY>
    <IntX>-25.884498</IntX>
    <AP>0</AP>
    <Price>10000</Price>
    <Level>1</Level>
    <Sold>0</Sold>
    <Products>91</Products>
    <Money>920</Money>
    <Z>13.553833</Z>
    <Y>-2105.518066</Y>
    <X>2421.240722</X>
    <Owner>Frank_Jones</Owner>
    <Status>1</Status>
    <Type>4</Type>
  </Biz>
  <Biz name="2">
    <IntInterior>12</IntInterior>
    <IntZ>1025.5448475</IntZ>
    <IntY>-1815.868988</IntY>
    <IntX>-12.884498</IntX>
    <AP>15</AP>
    <Price>30500</Price>
    <Level>4</Level>
    <Sold>1</Sold>
    <Products>100</Products>
    <Money>10000</Money>
    <Z>25.553833</Z>
    <Y>-3125.518066</Y>
    <X>1261.240722</X>
    <Owner>Johny_Mac</Owner>
    <Status>0</Status>
    <Type>6</Type>
  </Biz>
</XML>
And if you have this in y_ini.. You'll have to have a folder in scriptfiles and you will have to store each biz in each own ini file.

And BTW you seem to hate ******... lol
Reply
#6

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
And if you have this in y_ini.. You'll have to have a folder in scriptfiles and you will have to store each biz in each own ini file.
This argument is very illogical. It is only the common practice to have every biz assigned to it's own file, while it is not the only way to do it. You actually can have one .ini / text file for every biz, pretty much the same way(by using a string seperating one segment from another - also identifying the ID of the current segment).

Example from the Y_ini tutorial thread(although I have never used it before - and will refuse to I will use his example)

pawn Код:
new
    // The name of the file, can be any string variable or literal.
    fileToWrite[] = "mine.INI",
   
    // "INI_Open" returns a variable with tag "INI".
    INI:iniFile = INI_Open(fileToWrite);

//
// y_ini supports tags, that is:
//
//  [tag]
//  key = value
//
INI_SetTag(iniFile, "examples");

// Write an integer value with the key "some_integer" under the current tag:
INI_WriteInt(iniFile, "some_integer", 42);

// Now close the current file:
INI_Close(iniFile);
Basically, this has "tags" which can identify the segment validating a false statement in your claim. I have nothing against ****** however there is no need to make an include for every single possible thing you can think of.
Reply
#7

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
Well, XML is more like a database... An XML file is just like a table with items in it.
while in y_ini you will have to make multiple files.

For example, If you have a biz system in xml.. It'd be only 1 file for all bizs:
Код HTML:
<XML>
  <Biz name="1">
    <IntInterior>17</IntInterior>
    <IntZ>1003.546875</IntZ>
    <IntY>-185.868988</IntY>
    <IntX>-25.884498</IntX>
    <AP>0</AP>
    <Price>10000</Price>
    <Level>1</Level>
    <Sold>0</Sold>
    <Products>91</Products>
    <Money>920</Money>
    <Z>13.553833</Z>
    <Y>-2105.518066</Y>
    <X>2421.240722</X>
    <Owner>Frank_Jones</Owner>
    <Status>1</Status>
    <Type>4</Type>
  </Biz>
  <Biz name="2">
    <IntInterior>12</IntInterior>
    <IntZ>1025.5448475</IntZ>
    <IntY>-1815.868988</IntY>
    <IntX>-12.884498</IntX>
    <AP>15</AP>
    <Price>30500</Price>
    <Level>4</Level>
    <Sold>1</Sold>
    <Products>100</Products>
    <Money>10000</Money>
    <Z>25.553833</Z>
    <Y>-3125.518066</Y>
    <X>1261.240722</X>
    <Owner>Johny_Mac</Owner>
    <Status>0</Status>
    <Type>6</Type>
  </Biz>
</XML>
And if you have this in y_ini.. You'll have to have a folder in scriptfiles and you will have to store each biz in each own ini file.

And BTW you seem to hate ******... lol
Why don't you just use SQL instead?
Reply
#8

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Why don't you just use SQL instead?
There is nothing wrong with using text files, - he didn't create the include - ****** did. He seems to be sticking to files instead of SQL - You should directly address him.
Reply
#9

Quote:
Originally Posted by Abagail
Посмотреть сообщение
There is nothing wrong with using text files, - he didn't create the include - ****** did. He seems to be sticking to files instead of SQL - You should directly address him.
I know, but if you're looking for efficiency/organization, then why not go with SQL? I'm referring to the business system, maybe for other things this might be useful after all, but for a business system I would go with SQL.

Anyway, this is just another method to get the job done.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)