Welcome Guest ( Log In | Register )


Post new topic Reply to topic  [ 2 posts ] 
  Mon Jan 18, 2021 4:36 pm
User avatar

Omnipresent Merchant
My game is fucked, because it relies solely on one function that is used everywhere and that function is now deprecated.

I don't understand how to make it work asynchronously.

Basically my function is Ajax but synchronous:

Expand to see the code.

Such that I can use this function like so:

if (variable from web) == 1, do this
if (variable from web) == true, do that
Set (variable on web) to 7

Now I can do the third asynchronously, that's fine. But the first two require a response immediately, and I don't want or need the game to continue in that time.

For example, game switches is replaced with this function, so when a switch is used I do something like this (but with error handling and such):

Expand to see the code.

conditonal branch: script: {


Now that they're saying is that I have to handle this asynchronously instead. Now that doesn't make sense in the context of a conditonal branch.

Say I have a chest. I want to find out if the chest has been opened, so I ask the server (get_switch(1)). I don't want or need the script to continue processing until the response comes through, because I need the value for the rest of the script to make any kind of sense.

But I can't do this synchronously any more.

I don't even understand how this is supposed to work. I guess the answer is it doesn't?

Isn't this going to kill a lot of online games?

Top Top

  Tue Jan 19, 2021 9:30 am
very undead
User avatar

Comic Relief

Location: Australia
Hacky way: load the switch states on map load and poll the server for it every now and then
Proper way: provide callbacks to your jquery ajax calls (ie. success) to continue the code after the call instead, typically done using anonymous functions


Top Top
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Who is online

Users browsing this forum: No users and 18 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group