Ruby on Rails

Hi,


I'd like to post the data of RPG Maker to Ruby on Rails app.


Can anyone know how to deal with it?


I guess I need to change some js codes to post params with ajax.
I'd appreciate your help.
Please explain what you want - your post doesn't make any sense.


Ruby on Rails has nothing to do with any maker - the older makers use a special Ruby-Variant called RGGS, and RMMV has absolutely nothing to do with Ruby since it uses javascript.
Andar, thank you for your reply.

Once I made a simple app with Javascript and Ruby on Rails.  


In the game, users play a quiz game and the score is posted on the main page.  Each user competes the score.


http://quiz-techacademy.herokuapp.com



I hear that RPG Maker is based on javascript, so I guess that RPG game and Rails can be connected.   I want player to send the status about the game to Rails app at the end of the game.  For example, in the game below, after a player enters the cave, the game is over. I want to send "end" params to rails after the gameover screen is showed. 


I'd appreciate your advice.


スクリーンショット 2016-02-20 23.53.55.png


スクリーンショット 2016-02-20 23.54.05.png
You would just make a standard HTTP request to your server, from within the code.


RPG Maker doesn't offer a REST client natively so you will either need to add a library to do so, or just build XHR requests yourself.
Tsukihime,


Thanks for your advice.


Could you advice me where and how to write XHR requests?
 


I'd appreciate your help.
Tsukihime,


Thanks for your advice.


Could you advice me where and how to write XHR requests?
 


I'd appreciate your help.



You should find ample information in MDNs guide to using XMLHttpRequest.
Reashu,

Thank you for your advice!


I'll read the article.


Can you advice which file should be changed in js folder?
Reashu,

Thank you for your advice!


I'll read the article.


Can you advice which file should be changed in js folder?



Sorry, no, I just got started with RMMV yesterday and haven't come to grips with the standard classes yet. There's a standard plugin (included in every project, but inactive by default) called AltSaveScreen which might provide some hints if you don't want to wait only for game completion, but as for reacting on when the game ends I'm not sure. Maybe you could simply call your plugin from an event? In that case you wouldn't have to change any default behavior.
Reashu,

Thank you for your advice!


I'll read the article.


Can you advice which file should be changed in js folder?

It'll be the file that has the method call you're looking to trigger a request upon executing. At this moment, we don't really know what that is, since it would depend on where you want to call the request.

If you're looking to trigger it from an event instead, you could certainly call the code from the event, or write your own plugin/method to call.
I've moved this thread to Learning Javascript. Please be sure to post your threads in the correct forum next time. Thank you.



because this is not (yet) about a specific plugin development
Since you have to trigger the end of the game manually, you can manually execute the script all / plugin command to send the request, as well. You don't need to change any file for this and i recommend you to never do this, anyway. Always extend (or overwrite, if you really have to) objects from a plugin, so it can easily be disabled later.

Original thread: https://forums.rpgmakerweb.com/threads/ruby-on-rails.57216/