Pull Data From the game

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
Quick question if I modify the index.html to have php code, could I pull data from MV and pass it. For ex -


If I had a PHP var called $actor_Name = Some MV Data Variable. 


then I did a echo $actor_Name could it display the data from mv?


So what I am asking is it possible to get MV data out of MV with out using HTTP request to send the data? 
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,221
Reaction score
6,766
First Language
German
Primarily Uses
RMMV
what exactly do you want to do?


Most probably it would be easier to go the other way around, to have MV send that data when needed - because giving outside access may turn into a security problem on the website, depending on how it is done.
 

LTN Games

Veteran
Veteran
Joined
Jun 25, 2015
Messages
645
Reaction score
503
First Language
English
Primarily Uses
RMMV
You can't assign a PHP variable to a JavaScript variable. You can only do it the other way around. A JavaScript variable can be assigned a PHP variable. 


EDIT: I said that wrong lol, or it just sounds confusing let me try and rephrase. A JavaScript variable can be assigned a PHP variable but a PHP variable cannot be assigned to a JavaScript variable.


So phpvar = jsvar is not possible but jsvar = phpvar is possible. You can't simply do it that way there is a special way of doing it but I don't know PHP that well. I just remember attempting the same thing you want to do and learning it's not possible.
 
Last edited by a moderator:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,339
Reaction score
3,028
First Language
Portuguese
Primarily Uses
RMMV
To execute PHP code, you need to have PHP installed on the computer that is running it. And it can't interact with JS directly.


Even if it's the same computer, always imagine that PHP and Javascript are working on different computers. You can't make them talk to each other as if they were the same thing.


The only thing you can do is write PHP code that generates JS code to be executed along with the other JS later.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
876
Reaction score
581
First Language
English
Primarily Uses
RMMV
PHP can set a javascript var


javascript http request


php json_encode()


the two can communicate, I would go into details, but you can google too.


EDIT: (2nd glance, I read the op says no AJAX so I give you this)


Even if it's cross-server, it should take a JSONp. <script src="script.php?query" type="application/javascript"></script> I've recently learned that the thing is a browser.


Insert the tag with document.createElement and stuff too... I hope that's clear.
 
Last edited by a moderator:

2DGameStudios

Veteran
Veteran
Joined
Oct 11, 2015
Messages
184
Reaction score
43
First Language
English
Thanks Every one - I got it working to how i need it to know. 
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Updated my state Stacker Script on itch.io, github is down for some reason (probs just me).
Wife watching Locke and Key. This show is so bad!! You can't just acclimate to discovering magic or magical worlds in less than 60 seconds.
I think I still prefer RPG Maker over Dreams. Been playing around with it, and the controls are really the biggest flaw for me.
Watching Dragon Quest: Your Story on Netflix and already like 5 mins in we've passed over like 3 hours of gameplay.

Forum statistics

Threads
94,328
Messages
919,952
Members
124,077
Latest member
ArtsyWeasel
Top