event comment in javascript

Status
Not open for further replies.

Fumetsujo

Villager
Member
Joined
Jan 12, 2017
Messages
6
Reaction score
1
First Language
English & Dutch
Primarily Uses
Good day everybody,


Is there a javascript command to access and manipulate the event comment?


I am aware of the  '$dataMap.events[n].name', but  '$dataMap.events[n].comment ("blaba');' or  '$dataMap.events[n].comment = "bla"' doesn't seem to work. 


Thank  you in advance!


Regards,


Fumetsujo
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
That idea is wrong by principle, and you should explain what you really want.


By default, comments have no function and are never displayed to the player, so there is absolutely no reason to edit or change them from javascript.


What I assume is that you have a case where a comment is used to store data for a different plugin, and you want to change that data for the use of that other plugin dynamically.


If that is correct, then that is the wrong way for a lot of reasons, including the fact that you don't know when the other plugin reads that data, and that there is no way to change mapdata dynamically in default anyway, and a lot of other problems that would cause.


What is needed instead is that you change the data inside the other plugin after it was read. That would be easier, but it also means that it has a different solution depending on for which other plugin you want to change the data.


So please give more details what exactly you want to change for which other plugin, we can't help you otherwise.


I've moved this thread to Javascript Support. Please be sure to post your threads in the correct forum next time. Thank you.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Do you mean the note?


You could access it with $dataMap.events[n].note but as part of the loading process, MV also divides the notes into metadata, so if your note had something like <myname:XYZ> you could access it with $dataMap.events[n].meta.XYZ (I'm going from memory here as I'm at work and don't have MV in front of me).


However, for the reasons Andar has already mentioned, you should explain what you're trying to do rather than just how you're trying to do it, and why you're doing it this way, as it very likely won't do what you think it will do.   Also, not mentioned by Andar, is that the event will be reset when you leave the map and return, so any change you make will be undone anyway.
 

Fumetsujo

Villager
Member
Joined
Jan 12, 2017
Messages
6
Reaction score
1
First Language
English & Dutch
Primarily Uses
Hi, 


I'm using a plugin from Yep where you can set a title above the event's head. it is alterable in the comment of an event. 


Thank you for your feedback!


Note: I would use the plugin to show a player's name when he/she enters the online world. In the present state you  see an image of that user through a dedicated event . The map (and other data) are loaded and get updated through ajax calls. 


PS: It's about this plugin: http://yanfly.moe/2015/12/08/yep-40-event-mini-label/


Kind regards,


Fumetsujo
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
alright - thanks for the link.  Those are comments, not notes, so the bit of code I gave you will not work.


Normally you don't change the comments by scripting.  You just go to a new event page and have a different comment on that page.  This way, you can have one event with different labels simply by making different pages active.  Trying to do it by changing the comments via script is really a bad way to go about it, for all the reasons listed above, and because MV already provides a way to do it without scripting.
 

Fumetsujo

Villager
Member
Joined
Jan 12, 2017
Messages
6
Reaction score
1
First Language
English & Dutch
Primarily Uses
Thank you Shaz for your helpful answer! 


I suggest this topic is solved :)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
just report your post and ask the mods to close it.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,981
Members
137,563
Latest member
cexojow
Top