Good suggestion. I just finished making it capable of having many items that can be passed in a message. Getting ready to post my update in the next few minutes. For now it just a basic implementation, but I may add to it in the future.
The new version has been released
Actually typing the response to your question made me think through a scenario that made me realize that there is a bug in the code. If you only send one event, but there are multiple handlers waiting to respond, only one will trigger. I am working on that and will issue a new version soon.
That's a great question.
1) It decouples your code so you fire off an event and aren't concerned who or if anyone handles it.
2) Based on the event sent, you could have different logic executed on different event sheets. So lets say you have a player being hit by bullets. The player event sheet sends an event player hit, It's responsibility is all things about the player. The title screen may act on that message by changing the color of player. On the game screen it may decrease the health of the player.
3) You also could have multiple items respond differently based on the event. Lets say you emit an event for player health low. You could have a health bar that listens for that event and changes color, the player could listen for that event and start flashing, etc.
So it's a different way of organizing and thinking about your code in a more event system driven way where one event could have a multitude of results.
Hope this helps
You could just put a condition after the loop that will run as soon as the loop is done. I don't know if you really need an event for this.
Also for commas in a string I would start1 with an empty string. Then when you try to append to it check if its empty. If its empty just add the string. If it's not empty add a comma first and then the string. Then you never have to worry about having too many commas
Here is a new copy of that file that does what I think you are looking for without even using the built in array object. I populate an actual list object.
dropbox.com/s/m2lxy0ppsjlgdmt/jsonSample%20%283%29.c3p?dl=0
Got it. I'll take a look at it
I didn't get a link. In the reply it said deleted. You could post a question in the sdk forum and then you can select that it's a link so that it'll stay in the message.
if you just put it up on google drive, one drive, etc... and just share it and send me the link I'll be more than happy to take a look
Was this generated from the JsonManager. What might be easier if you have a sample project I can look at to see if I can help
I'm away from my computer now for a bit. The example should have a load from string button. You don't have to specify the slot in the ui. The load string will create the slot. I haven't hooked up any out put to the debug window yet. The easiest way is to use the browser alert and use the json manager to get a value
You don't have to use the original load method if you are using the string one.
No Problem
I also updated the example project to include this new functionality if you need to look at it.
I just published version 1.0.1 which adds a new action to load json from a string. The action is called Load Json From String. Hope this helps
I know I am double posting, I didn't pay attention that i replied to the same person in the forums :) I will look at adding the ability to load json from a string as an option.
It loads the json file through ajax itself internally. The example project shows how that works. Since it handles the ajax call behind the scenes, I didn't think it would be necessary to load it from a string. I can certainly look at adding that functionality if you feel it's really needed and can't be met using the functions in the plugin to load itself with the data.
Member since 6 Jun, 2014
Look into different ways to structure games