From The Mana World
(→‎NPC section suggestion: Now a suggestion on the whole Map objects section)
(Resurrecting comments I slayed, moving proposal to new page)
Line 3: Line 3:
Perhaps we should regulate comments?
Perhaps we should regulate comments?


==EOF newline==
===Proposal===
I’m working on a proposal [[User:Kess/eAthena scripting|here]]. Earlier comments on what was here follows below. ✎ [[User:Kess|Kess]]<sup>[[User talk:Kess|☽]]</sup> 04:11, 19 October 2008 (CEST)
 
====On ending script files with a newline====
I’d like to propose that all script files should have a mandatory newline at the end of file, to ease working with shell scripts on these files. —[[User:Kess|kess]] 14:01, 14 October 2008 (CEST)
I’d like to propose that all script files should have a mandatory newline at the end of file, to ease working with shell scripts on these files. —[[User:Kess|kess]] 14:01, 14 October 2008 (CEST)


==Suggestion: Map objects==
====On NPC section suggestion====
{|border="0" cellspacing="0" cellpadding="2" style="float: right;"
Yeah, I never got around to doing this. The first question mark is the direction (I assume facing direction, 8 compass values available), which we don't use. The second two are indeed optional. They define an activation area, which only that one NPC uses (to warn you when you get too close). The only thing we need to do is determine how the numbers for the activation area work. &mdash; [[User:Jaxad0127|<span style="color: #160196">Jaxad</span>]][[User Talk:Jaxad0127|<span style="color: #5B038F">0127</span>]] 17:51, 14 October 2008 (CEST)
!colspan="2"| Key
|-
| <TAB>
| a tab
|-
| text
| static text, do not change
|-
| '''text'''
| obligatory value, change this
|-
| '''''text'''''
| optional value, may be skipped
|}
 
These sections describe how to define map objects.
 
=== Warps ===
Warps are what move players between maps. They can also be used to move players around a single map, if needed. Warps are defined like this:
 
'''map1''','''startX''','''startY'''<TAB>warp<TAB>'''name'''<TAB>'''width''','''height''','''map2''','''endX''','''endY'''
 
Where
* '''map1''' is the map which the player will warp from
* '''startX''' is the x-coordinate of the tile the player will warp from
* '''startY''' is the y-coordinate of the tile the player will warp from
* '''name''' is the name of the warp, unused but must be defined
* '''width''' is the width of the warp
* '''height''' is the height of the warp
* '''map2''' is the map which the player will warp to
* '''endX''' is the x-coordinate of the tile the player will end up on
* '''endY''' is the y-coordinate of the tile the player will end up on
 
Width and height are described in detail in [[EAthena Scripting Standards/Warp Details|Warp Details]].
 
<pre>// Warp example (npc/new_10-1-xmas/passages.txt)
 
new_10-1.gat,69,19 warp tovillage 4,1,new_11-1.gat,69,127</pre>
 
=== Monsters ===
Monsters are defined like this:
 
'''map''','''x''','''y''','''width''','''height'''<TAB>monster<TAB>'''name'''<TAB>'''mobID''','''count''','''spawn1''','''spawn2''','''event'''
 
Where
 
* '''map''' is the map the monsters should appear on
* '''x''' is the x-coordinate of the spawn tile
* '''y''' is the y-coordinate of the spawn tile
* '''width''' is the tile width of the spawn area
* '''height''' is the tile height of the spawn area
* '''name''' is the name of the mob, unused but must be defined
* '''mobID''' is the mob identifier of the desired monster (in the monster database [http://themanaworld.svn.sourceforge.net/viewvc/themanaworld/server-data/trunk/db/mob_db.txt?view=markup])
* '''count''' is the number to spawn
* '''spawn1''' is the minimum delay between successive spawns (per individual)
* '''spawn2''' is the minimum delay between death and respawn (per individual)
* '''event''' is the script event to fire upon death
 
A detailed description of position and area can be found in [[EAthena Scripting Standards/Mob Details|Mob Details]].
 
<pre>// Monster example (npc/new_9-1-woodland/monsters.txt)
 
new_9-1.gat,0,0,0,0 monster EvilMushroom 1013,25,0,0,0
new_9-1.gat,0,0,0,0 monster SleepFlower 1014,40,0,0,0
new_9-1.gat,0,0,0,0 monster Alzarin 1032,1,2700000,1800000,0</pre>
 
=== NPCs ===
NPCs are defined like
 
'''map''','''x''','''y''','''direction'''<TAB>script<TAB>'''name'''<TAB>'''npcID''','''''area1''''','''''area2''''',{
 
:'''''script'''''
}
 
Where
 
* '''map''' is the map the NPC is located in
* '''x''' is the x-coordinate of the NPC
* '''y''' is the y-coordinate of the NPC
* '''direction''' is the direction the NPC faces, unused but must be defined
* '''name''' is the name of the NPC, to hide (the latter part of) a name to the client begin (that part of) the name with a hash (#)
* '''npcID''' is the NPC identifier (in the NPC database [http://themanaworld.svn.sourceforge.net/viewvc/themanaworld/tmwdata/trunk/npcs.xml?view=markup])
* '''''area1''''' and '''''area2''''' describe the map area which activates the NPC, optional
* '''''script''''' is the NPC script, see the below
 
The name of the NPC can be hidden to the player, part of the name or the whole. Begin the name with a hash (#) to hide the whole name, or add it before the part which should be truncated (it will be truncated to the end).
 
<pre>// NPC example with activation area (npc/new_37-1-woodland-mine/miners.txt)
 
new_37-1.gat,78,59,0 script Miner 109,1,1,{
mes "[Miner]";
mes "\"I'm sorry, but this area is closed off.\"";
}</pre>
 
=== Shops ===
Shops are defined like
 
'''map''','''x''','''y''','''direction'''<TAB>shop<TAB>'''name'''<TAB>'''npcID''','''inventory'''
 
Where
 
* '''map''' is the map the shop is located in
* '''x''' is the x-coordinate of the shop
* '''y''' is the y-coordinate of the shop
* '''direction''' is the direction the shop faces, unused but must be defined
* '''name''' is the name of the shop, to hide (the latter part of) a name to the client begin (that part of) the name with a hash (#)
* '''npcID''' is the NPC identifier for the shop
* '''inventory''' is a comma separated inventory list of items to sale
 
The inventory is defined like
 
'''itemID''':'''price'''[,'''itemID''':'''price''']*
 
Where [...]* means that part can be repeated as necessary, and
 
* '''itemID''' is the item identifier (in the item database [http://themanaworld.svn.sourceforge.net/viewvc/themanaworld/server-data/trunk/db/item_db.txt?view=markup])
* '''price''' is the price the item is sold for
 
You add an item:price pair for any item that should be sold by the shop.
 
<pre>// Shop example (npc/new_23-1-dimonds-cove/dimonds.txt)


new_23-1.gat,24,27,0 shop Bartender 107,539:175,567:500,568:500</pre>
The name is used, it shows below the npc. [[User:EJlol|EJ]] 10:42, 15 October 2008 (CEST)


===Comments===
: Is it possible to use ''name'' as a constant in the script part? Something like:
I’m learning a little about the eAthena scripting, so I’m putting it here for now. If anyone has a suggestion on how to write the syntax, please tell. I’d personally prefer something unambivalent and terse, but as this page is about being easily understood that’s perhaps not the perfect choice. I’ll continue to add here as I learn more. ✎ [[User:Kess|Kess]]<sup>[[User talk:Kess|☽]]</sup> 12:49, 17 October 2008 (CEST)
mes "["+@NAME$+"]";
mes "\"Dialogue...\"";
: ✎ [[User:Kess|Kess]]<sup>[[User talk:Kess|☽]]</sup> 13:48, 15 October 2008 (CEST)

Revision as of 02:11, 19 October 2008

Irving Rivas, 31/7/07:

Perhaps we should regulate comments?

Proposal

I’m working on a proposal here. Earlier comments on what was here follows below. ✎ Kess☽ 04:11, 19 October 2008 (CEST)

On ending script files with a newline

I’d like to propose that all script files should have a mandatory newline at the end of file, to ease working with shell scripts on these files. —kess 14:01, 14 October 2008 (CEST)

On NPC section suggestion

Yeah, I never got around to doing this. The first question mark is the direction (I assume facing direction, 8 compass values available), which we don't use. The second two are indeed optional. They define an activation area, which only that one NPC uses (to warn you when you get too close). The only thing we need to do is determine how the numbers for the activation area work. — Jaxad0127 17:51, 14 October 2008 (CEST)

The name is used, it shows below the npc. EJ 10:42, 15 October 2008 (CEST)

Is it possible to use name as a constant in the script part? Something like:
mes "["+@NAME$+"]";
mes "\"Dialogue...\"";
✎ Kess☽ 13:48, 15 October 2008 (CEST)