ta script: add get coords commands

Content and general development discussion, including maps, quests, and server code from the development team.
Post Reply
nmaligec
Novice
Novice
Posts: 253
Joined: Thu Apr 08, 2010 2:55 am

ta script: add get coords commands

Post by nmaligec » Wed Jan 26, 2011 8:34 am

I noticed that there is no way to get a player's map coordinates. It should be easy to expose a get coord command for scripting. What about a set player coords, can this be done, along with the appropriate client update?

For npcs, would it be possible to get/set their coords?

I would really want to be able to get/set mob coords. I know there is currently no way to interact with mobs through scripting. If we can get the mob's id when it is created and store it, then it would be possible to interact with it through specialized commands? Maybe have a special spawnOne command that spawns one mob and returns its id.
Snurayroth
Newly Registered User
Posts: 2
Joined: Mon Mar 28, 2011 6:17 pm

Re: ta script: add get coords commands

Post by Snurayroth » Mon Mar 28, 2011 7:03 pm

Im totally New to TMW, im from the eAthena forum and worked for years with eAthena.
I dont know how eAthena works with the TMW client, i suspect ur eAthena(TMW) no longer corresponds to the original eAthena but usually ... erm take a look:

Code: Select all

*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})

This function will locate a character object, NPC object or pet's coordinates 
and place their coordinates into the variables specified when calling it. It 
will return 0 if the search was successful, and -1 if the parameters given were 
not variables or the search was not successful.

Type is the type of object to search for:

  0 - Character object
  1 - NPC object
  2 - Pet object
  3 - Monster object.
  
While 3 is meant to look for a monster object, no searching will be done if you 
specify type 3, and the function will always return -1.

The search string is optional. If it is not specified, the location of the 
invoking character will always be returned for types 0 and 2, the location of 
the NPC running this function for type 1.
If a search string is specified, for types 0 and 1, the character or NPC with 
the specified name will be located. If type is 3, the search will locate the 
current pet of the character who's name is given in the search string, it will 
NOT locate a pet by name.

What a mess. Example, a working and tested one now:

    prontera.gat,164,301,3|	|script|	|Meh|	|730,{
        mes "My name is Meh. I'm here so that Nyah can find me.";
        close;
    }

    prontera.gat,164,299,3|	|script|	|Nyah|	|730,{
        mes "My name is Nyah.";
        mes "I will now search for Meh all across the world!";
        if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) goto Notfound;
        mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
        close;
    Notfound:
        mes "I can't seem to find Meh anywhere!";
        close;
   }
   
Notice that NPC objects disabled with 'disablenpc' will still be located. 

I hope I could help you with this. My english isn't very good. sorry xD
nmaligec
Novice
Novice
Posts: 253
Joined: Thu Apr 08, 2010 2:55 am

Re: ta script: add get coords commands

Post by nmaligec » Mon Mar 28, 2011 10:42 pm

Your knowledge of eAthena scripting is very helpful, especially for fakenpcname. Unfortunately tmwAthena is lacking several commands. getmapxy is one of them. In the manual I was referencing it said getmapxy did not work properly for mobs, I guess they fixed it since the manual version I was looking at.

The commands I am most bummed about not having are:
  • setcell/setwall
  • areamobuseskill
  • for (no built in loops!)
  • if, with multiple statements
  • anything that acesses a spawned mobs info (you can get the mob db info but not current hp or location)
  • a command that lets you do something to all pcs in an area/map.
  • clone (not crucial but it would have been fun)
If you are interested in knowing what commands are currently implemented you can sorta get a list by checking out the source code for scripts. Check lines 115-318, the format is
int buildin_commandname (struct script_state *st);

here is the link (be patient if it doesnt load right away, it is a large file):
http://gitorious.org/tmw-eathena/mainli ... p/script.c
Zutan
Peon
Peon
Posts: 60
Joined: Tue Feb 22, 2011 3:43 am

Re: ta script: add get coords commands

Post by Zutan » Tue Mar 29, 2011 11:17 pm

The manaplus client is able to show map co-ordinates, is that client side?
User avatar
Freeyorp101
Administrator
Administrator
Posts: 704
Joined: Tue Nov 04, 2008 10:17 am
Location: New Zealand

Re: ta script: add get coords commands

Post by Freeyorp101 » Tue Mar 29, 2011 11:34 pm

This is regarding tmwAthena scripting and has absolutely nothing to do with what the client displays.


---Freeyorp
(09:58:17) < tux9th> Freeyorp: your sig on the forums is kind of outdated
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: ta script: add get coords commands

Post by Crush » Wed Mar 30, 2011 7:47 am

The normal client also displays map coordinates in the F10 window. We have this feature for ages. It's funny how many features are attributed to the ManaPlus patch although they have been core features of the unmodified client for ages. But, as Freeyorp pointed out, this is off topic.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
Zutan
Peon
Peon
Posts: 60
Joined: Tue Feb 22, 2011 3:43 am

Re: ta script: add get coords commands

Post by Zutan » Fri Apr 01, 2011 12:07 am

Ohh. Thanks for that. I use .29 1.0 and manaplus almost everyday sometimes things jump out more on one client than the others.

So the client does the calculating of that from data files I am guessing. Does the server see players when monsters with aggro come into view?
User avatar
Freeyorp101
Administrator
Administrator
Posts: 704
Joined: Tue Nov 04, 2008 10:17 am
Location: New Zealand

Re: ta script: add get coords commands

Post by Freeyorp101 » Fri Apr 01, 2011 1:48 am

The server has the complete state of the game world at any time.


---Freeyorp
(09:58:17) < tux9th> Freeyorp: your sig on the forums is kind of outdated
Post Reply