1 of 1 people found this helpful
Your post intrigued me, and I wound up playing with the attached file much longer than I expected -- just to see if I could gain some insight into the symptom you described.
I have not got any solid theory, though I agree with you that a timing problem seems likely. One extra observation that I can add is that, even if I closed the file, as long as I left FMPA running, when I reopened the file and started a new game, the moves would be properly retained provided I had run at least one new game before closing the file.
My last comments are simply to compliment you on a great looking file and a really fun concept that you are working on, and to say thanks for posting it. I know that you have posted information about Processing.js before, and, though I was intrigued, I never took a look. This time, I pulled apart everything, and read/perused the .pde source file, as well as the processing.js file. Thanks to your post, the little bit of hands on investigation I did left me with a much better sense of how this must be a fun and productive environment for doing certain types of tasks in the webviewer. I can see why you like it. Thank you for sharing it here.
Good luck with this! My guess is that there must be some sort of lesser-elegant workaround that can be done to just force the code to "pre-load" before starting a game, but it would be nice to actually get down to the specifics of what is going wrong...
And of course the first-run would be different because the variable has either not been set or is empty.
(sorry for stating the obvious)
Thanks Steve for your pointers.
I think I have found the reason.
In the Gomoku.pde Processing code, there is line 405 which calls callBackToFM(move_color,x_pressed,y_pressed) upon mouse click.
After the function had been called, program control should go back to the calling Processing code and Processing should continue to draw the board and the moves. This can be investigated by uncommenting line 406.
I have now slightly adapted the Processing code and the FileMaker scripts so that the Back function of the web viewer isn't used anymore, but the Web viewer is always reset upon a move. All the moves that have been played already are passed via game.xml to Processing, which redraws them from scratch.
In the attachment, you find the new version (including a splash screen with a few explanations).
While this works now, I can think about adding more patters and implementing a game engine (so that FileMaker can play against a human).
Message was edited by: MartinBraendle
Gomoku.zip 146.2 K