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,230
Reaction score
6,774
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 Profile Posts

This forum is a great source of procrastination for me.
Today I read "The mouth speaks what the heart is full of." Simple, and reminds me I have a ton of work to do.
Why are cats so darn cute when their tongues are sticking out? If I did that, it wouldn't have the same effect.
The joy when you see a notification, the down when it's just a unnecessary quote of one of your posts again.

Forum statistics

Threads
94,399
Messages
920,619
Members
124,179
Latest member
mybriguy
Top