Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So, I tried creating a "multiplayer"... thing (with some tips from there: https://www.ambiera.com/forum.ph...). And so, I need to make a few variables in one file. The thing is that I know how to write multiple of variables in one file (like ccbWriteFileContent(file, var1 + " " + var2 +...) or kinda like that), but how do I make it read this file as a multiple variables? Is there a way to do this? |
||||
|
I answered this already here: https://www.ambiera.com/forum.ph... But I will write an example for your specific question. Assume I have a txt file named data.txt with this content: ccbSetCopperCubeVariable("A", "Apple"); ccbSetCopperCubeVariable("B", "Banana"); ccbSetCopperCubeVariable("C", "Cherry"); Then I would write a function like this one below:
You would then invoke the function in a Before first drawing do something > Execute Java Script behavior and action like so:
This is just how I would do it. Others may have a better way. If you have any questions about the code, I will answer them. Hope this helped. |
||||
|
dekon_17 wrote: So, I tried creating a "multiplayer"... thing (with some tips from there: https://www.ambiera.com/forum.ph...). And so, I need to make a few variables in one file. The thing is that I know how to write multiple of variables in one file (like ccbWriteFileContent(file, var1 + " " + var2 +...) or kinda like that), but how do I make it read this file as a multiple variables? Is there a way to do this? I made script that saves and loads variables for game saveing. https://www.ambiera.com/forum.ph... Just take a look into script and you see how i made it. |
||||
|
Noticed some issues with my code. Here's the corrected version of the function:
|
||||
|
Thanks guys! Also, sorry for a bit late answer. If I won't be able to do a multiplayer (due to my -5 IQ, lol), I still can use this in order to create a save system (like sven just shown) or something. |
||||
|
wrote: Thanks guys! Also, sorry for a bit late answer. If I won't be able to do a multiplayer (due to my -5 IQ, lol), I still can use this in order to create a save system (like sven just shown) or something. you can use my multiplayer example that i made..its working example.. search udp lan multiplayer by sven. its ok enaught for start. |
||||
|
better use JSON create an object with properties for all player positions and their inventory then convert this object to a JSON text write json text to file then all read that file and read that json text into gameobject and update all positions except your own. |
|