I have a client server model, and basically the client sends a request to the server saying "I want variable a now". The server sends variable a back to the client.
This comes in in the form $requested_variable, let's say.
The problem I have is there will be a brief wait until $requested_variable is set to the new variable.
Imagine I have this function:
Since $requested_variable isn't set right until it comes back from the server, I'm kind of stuck here as $requested_variable will just be nil.
What I tried was this:
When the variable comes back, set $gotanewvariable = true
Then,
This didn't work. The game just hung and nothing happened ($requested_variable never came through).
Anyone got any ideas how I should handle this situation?
This comes in in the form $requested_variable, let's say.
The problem I have is there will be a brief wait until $requested_variable is set to the new variable.
Imagine I have this function:
def get_var(a)
# send request to server, blahdeblah, it comes back eventually as $requested_variable
return $requested_variable
Since $requested_variable isn't set right until it comes back from the server, I'm kind of stuck here as $requested_variable will just be nil.
What I tried was this:
When the variable comes back, set $gotanewvariable = true
Then,
def get_var(a)
# send request to server, comes back as $requested_var
while $gotanewvariable != true
# do nothing
end
$gotanewvariable = false
return $requested_variable
end
This didn't work. The game just hung and nothing happened ($requested_variable never came through).
Anyone got any ideas how I should handle this situation?