IT/Meta.xml: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: Category:0% {{IT/MainP}} Il file '''meta.xml''' è uno dei file più importanti che tutte le risorse/gamemode/mappe possono caricare. You'll need to include names of files that you scr...)
 
No edit summary
Line 1: Line 1:
[[Category:0%]]
[[Category:100%]]
{{IT/MainP}}
{{IT/MainP}}
Il file '''meta.xml''' è uno dei file più importanti che tutte le risorse/gamemode/mappe possono caricare. You'll need to include names of files that you script/gamemode (resource) is going to use in an '''meta.xml''' file.
Il file '''meta.xml''' è uno dei file più importanti che tutte le risorse/gamemode/mappe possono caricare. I nomi dei file che i tuoi script ([[IT/Risorsa|risorse]]) andranno scritti nel file ''meta.xml''.
Eg. If you want to display an image on the client's screen, the client needs to download the image first. To tell the server that you want to use an image in the script you'll need to include the file's name in the meta.xml file.<br />
Ad esempio se vuoi mostrare una immagine sullo schermo del client, il client ha prima bisogno di scaricare l'immagine. Per dire al server che vuoi usare un'immagine nello script dovrai inserire il nome del file immagine nel meta.xml.<br />
If you want to use some settings for the script as a variable you can set them in <settings> tag.
Se vuoi impostare delle opzioni nello script come variabili dovrai usare il tag <syntaxhighlight lang="lua"><settings></syntaxhighlight>.


Note: You can try simple Meta.xml generator made by 50p: http://forum.mtasa.com/viewtopic.php?f=91&t=22247
'''Nota:''' Puoi trovare un semplice generatore di meta.xml creato da ''50p'' [http://forum.mtasa.com/viewtopic.php?f=91&t=22247 qui].


== Possible tags ==
== Possibili tag ==
Tags in .xml are same as in the . html. meta.xml file has got couple of tags that are required and not required. There are attributes as well.
I tag nell'XML sono molto simili a quelli dell'HTML. Il file ''meta.xml'' ha diverse coppie di file che possono essere o meno obbligatori. Alcuni tag hanno degli attributi.


Possible tags:
*'''<info />''' Informazioni sulla risorsa attuale, tra i parametri troviamo (è possibile anche creare dei parametri personalizzati, leggibili tramite [[IT/getResourceInfo|getResourceInfo]]):
*'''<info />''' Information about this resource, possible parameters include (any arbitrary parameters can be used and read using [[getResourceInfo]]):
** '''author:''' L'autore della risorsa.
** '''author:''' The author of this resource
** '''version:''' La versione attuale della risorsa.
** '''version:''' The version of this resource
** '''name:''' Il nome della risorsa.
** '''name:''' The name of this resource
** '''description:''' Una breve descrizione della risorsa.
** '''description:''' A brief description of this resource
** '''type:''' Il tipo di risorsa, che può essere "gamemode", "script" o "map".
** '''type:''' The type of this resource, that can be "gamemode", "script" or "map".
*'''<script />''' Il codice sorgente della risorsa, tra i cui parametri abbiamo:
*'''<script />''' Source code for this resource, possible parameters are:
** '''src:''' Il nome del file del sorgente.
** '''src:''' The file name of the source code
** '''type:''' Il tipo di sorgente: "client" o "server".
** '''type:''' The type of source code: "client" or "server"
*'''<map />''' Le mappe della gamemode, tra i cui parametri troviamo:
*'''<map />''' The map for a gamemode, possible parameters are:
**'''src:''' Il nome o il percorso del file .map (es: "mappe/nomefile.map")
**'''src:''' .map file name (can be path too eg. "maps/filename.map")
*'''<file />''' I file client-side. In genere si tratta di file texture (.txd), [[IT/Elemento/Collision shape|collision shapes]] (.col), immagini o modelli 3D (.dff). Questi file verranno scaricati automaticamente dal client.
*'''<file />''' A client-side file. Generally these are images or .txd .col .dff files. They'll be downloaded by clients when the resources is started (or on join)
**'''src:''' Nome o il percorso del file client-side (es: "immagini/immagine.png")
**'''src:''' client-side file name (can be path too eg. "images/image.png")
*'''<include />''' Risorse da includere in quella attuale.
*'''<include />''' Include resources that this resource will use
**'''resource:''' Nome della risorsa da avviare insieme a quella attuale.
**'''resource:''' Resource name that you want to start with this resource
*'''<config />''' Un file di configurazione (.xml) a cui la risorsa può accedere, tra i parametri troviamo:
*'''<config />''' Config file (.xml) can be accessed by resource, possible parameters are:
**'''src:''' Nome del file di configurazione.
**'''src:''' The file name of the config file
**'''type:''' Tipo del file di configurazione: "client" o "server".
**'''type:''' The type of the config file: "client" or "server"
*'''<export />''' Le funzioni che la risorsa esporterà, cosicché le altre risorse possano chiamarle con [[IT/call|call]].
*'''<export />''' This exports functions from this resource, so other resources can use them with [[call]]
**'''function:''' Il nome della funzione.
**'''function:''' The function name
**'''http:''' Se la funzione può essere chiamata via HTTP (true/false).
**'''http:''' Can the function be called via HTTP (true/false)
*'''<html />'''
*'''<html />'''
**'''src:''' The filename for the HTTP file (can be a path)
**'''src:''' Il nome del file HTML (può anche essere un percorso).
**'''default:''' The html file is one that is shown by default when visiting /resourceName/ on the server. Only one html can be default, the rest are ignored. (true/false)
**'''default:''' Se il file HTML viene mostrato di default quando si va in remoto su <syntaxhighlight lang="lua">/resourceName/</syntaxhighlight>. Un solo file HTML può essere default, gli altri vengono ignorati (true/false).
**'''raw:''' The html file is not parsed by the LUA interpreter and is treated as binary data. Must be used for binary files (images mainly) (true/false)
**'''raw:''' Se il file HTML non deve essere processato dall'interprete LUA, e viene trattato come dati binari. Deve essere usato per file binari (in genere immagini) (true/false).
*'''<settings> </settings>'''
*'''<settings> </settings>'''


== Example ==
== Esempio ==
Heres an example of a meta file using some of the tags mentioned:
Questo è un esempio di file XML che utilizza alcuni dei tag sopra descritti:
<syntaxhighlight lang="xml"><meta>
<syntaxhighlight lang="xml"><meta>
     <info author="Slothman" type="gamemode" name="Stealth" />
     <info author="Pinco" type="gamemode" name="Stealth" />
     <config src="help.xml" type="client"/>
     <config src="help.xml" type="client"/>


Line 69: Line 68:


     <settings>
     <settings>
         <setting name="roundlimit" value="[6]" /> <!-- round length in minutes -->
         <setting name="roundlimit" value="[6]" /> <!-- lunghezza dei round in minuti -->
<setting name="teamdamage" value="[1]" /> <!-- 0 for team protection off, 1 for team protection on -->
<setting name="teamdamage" value="[1]" /> <!-- 0 per il fuoco amico abilitato, 1 per il fuoco amico disattivato -->
<setting name="teambalance" value="[1]" /> <!--  difference limit of amount of players between teams -->
<setting name="teambalance" value="[1]" /> <!--  differenza massima di giocatori tra un team e l'altro -->
<setting name="spazammo" value="[25]" /> <!-- ammo amounts -->
<setting name="spazammo" value="[25]" /> <!-- quantità di munizioni -->
<setting name="m4ammo" value="[100]" />
<setting name="m4ammo" value="[100]" />
<setting name="shotgunammo" value="[25]" />
<setting name="shotgunammo" value="[25]" />
Line 89: Line 88:
     </settings>
     </settings>
</meta></syntaxhighlight>
</meta></syntaxhighlight>
[[Category:Scripting Concepts]]
[[Category:IT/Concetti di scripting]]
[[Category:Incomplete]]

Revision as of 17:29, 7 June 2008


« Torna alla Pagina principale italiana .

Il file meta.xml è uno dei file più importanti che tutte le risorse/gamemode/mappe possono caricare. I nomi dei file che i tuoi script (risorse) andranno scritti nel file meta.xml. Ad esempio se vuoi mostrare una immagine sullo schermo del client, il client ha prima bisogno di scaricare l'immagine. Per dire al server che vuoi usare un'immagine nello script dovrai inserire il nome del file immagine nel meta.xml.

Se vuoi impostare delle opzioni nello script come variabili dovrai usare il tag

<settings>

.

Nota: Puoi trovare un semplice generatore di meta.xml creato da 50p qui.

Possibili tag

I tag nell'XML sono molto simili a quelli dell'HTML. Il file meta.xml ha diverse coppie di file che possono essere o meno obbligatori. Alcuni tag hanno degli attributi.

  • <info /> Informazioni sulla risorsa attuale, tra i parametri troviamo (è possibile anche creare dei parametri personalizzati, leggibili tramite getResourceInfo):
    • author: L'autore della risorsa.
    • version: La versione attuale della risorsa.
    • name: Il nome della risorsa.
    • description: Una breve descrizione della risorsa.
    • type: Il tipo di risorsa, che può essere "gamemode", "script" o "map".
  • <script /> Il codice sorgente della risorsa, tra i cui parametri abbiamo:
    • src: Il nome del file del sorgente.
    • type: Il tipo di sorgente: "client" o "server".
  • <map /> Le mappe della gamemode, tra i cui parametri troviamo:
    • src: Il nome o il percorso del file .map (es: "mappe/nomefile.map")
  • <file /> I file client-side. In genere si tratta di file texture (.txd), collision shapes (.col), immagini o modelli 3D (.dff). Questi file verranno scaricati automaticamente dal client.
    • src: Nome o il percorso del file client-side (es: "immagini/immagine.png")
  • <include /> Risorse da includere in quella attuale.
    • resource: Nome della risorsa da avviare insieme a quella attuale.
  • <config /> Un file di configurazione (.xml) a cui la risorsa può accedere, tra i parametri troviamo:
    • src: Nome del file di configurazione.
    • type: Tipo del file di configurazione: "client" o "server".
  • <export /> Le funzioni che la risorsa esporterà, cosicché le altre risorse possano chiamarle con call.
    • function: Il nome della funzione.
    • http: Se la funzione può essere chiamata via HTTP (true/false).
  • <html />
    • src: Il nome del file HTML (può anche essere un percorso).
    • default: Se il file HTML viene mostrato di default quando si va in remoto su
      /resourceName/
      . Un solo file HTML può essere default, gli altri vengono ignorati (true/false).
    • raw: Se il file HTML non deve essere processato dall'interprete LUA, e viene trattato come dati binari. Deve essere usato per file binari (in genere immagini) (true/false).
  • <settings> </settings>

Esempio

Questo è un esempio di file XML che utilizza alcuni dei tag sopra descritti:

<meta>
    <info author="Pinco" type="gamemode" name="Stealth" />
    <config src="help.xml" type="client"/>

    <script src="stealthmain_server.lua" />
    <script src="noiseblip.lua" />
    <script src="mission_timer.lua" />
    <script src="gadgets_server.lua" />
    <script src="gadgets_client.lua" type="client"/>
    <script src="stealthmain_client.lua" type="client"/>
    <script src="noisebar.lua" type="client"/>
    <script src="spycam.lua" type="client"/>

    <file src="riot_shield.txd" />
    <file src="riot_shield.dff" />
    <file src="riot_shield.col" />
    <file src="armor.png" />
    <file src="camera.png" />
    <file src="cloak.png" />
    <file src="goggles.png" />
    <file src="mine.png" />
    <file src="radar.png" />
    <file src="shield.png" />

    <include resource="scoreboard" />
    <include resource="killmessages" />
    <include resource="maplimits" />

    <settings>
         <setting name="roundlimit" value="[6]" /> <!-- lunghezza dei round in minuti -->
	 <setting name="teamdamage" value="[1]" /> <!-- 0 per il fuoco amico abilitato, 1 per il fuoco amico disattivato -->
	 <setting name="teambalance" value="[1]" /> <!--  differenza massima di giocatori tra un team e l'altro -->
	 <setting name="spazammo" value="[25]" /> <!-- quantità di munizioni -->
	 <setting name="m4ammo" value="[100]" />
	 <setting name="shotgunammo" value="[25]" />
	 <setting name="sniperammo" value="[20]" />
	 <setting name="ak47ammo" value="[120]" />
	 <setting name="rifleammo" value="[40]" />
	 <setting name="deserteagleammo" value="[45]" />
	 <setting name="pistolammo" value="[132]" />
	 <setting name="uziammo" value="[150]" />
	 <setting name="tec9ammo" value="[150]" />
	 <setting name="silencedammo" value="[65]" />
	 <setting name="grenadeammo" value="[4]" />
	 <setting name="satchelammo" value="[4]" />
	 <setting name="teargasammo" value="[4]" />
	 <setting name="molatovammo" value="[4]" />
     </settings>
</meta>