Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - drown

Pages: 1 [2]
Playmaker Help / Re: Data Maker JSON to XML Error[SOLVED]
« on: January 13, 2017, 06:51:29 AM »
Thank you so much jean, that works perfectly fine! This is more of an answer than I have wished for since I can finally understand how exactly to use the xPath Query since I never heard of it before.

I am really happy right now!

Playmaker Help / Re: Data Maker JSON to XML Error
« on: January 12, 2017, 01:52:25 AM »
Haven't thought about doing a String Replace, cant wait to try that!

I want the Max temperature and the wind direction code. I watched the Data Maker tutorial series on Youtube, but I cant match the xpath querys hes using to my usecase. Glad you are eager to help :)


Playmaker Help / Data Maker JSON to XML Error[SOLVED]
« on: January 11, 2017, 02:45:47 PM »
Hey guys!

I am currently learning how to fetch data from web APIs/Websites and turn them into Playmaker variables. I have an example where I get the current weather data from an API , convert it to variables and display it ingame. It works just fine.

However, for some JSON requests I get an error and some work just fine. If I try to turn this JSON request to a XML , it works fine :

Code: [Select]
{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"base":"stations","main":{"temp":278.24,"pressure":1010,"humidity":69,"temp_min":277.15,"temp_max":279.15},"visibility":10000,"wind":{"speed":6.7,"deg":260},"clouds":{"all":75},"dt":1484167800,"sys":{"type":1,"id":5187,"message":0.0169,"country":"GB","sunrise":1484121702,"sunset":1484151385},"id":2643743,"name":"London","cod":200}
I can acess this just fine. If, however, I get this response from the very same API for a differen location , I get an error while using the "Convert Json String To XML Node" - Action:

Code: [Select]
{"coord":{"lon":11.19,"lat":54.44},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"base":"stations","main":{"temp":278.132,"pressure":1003.42,"humidity":94,"temp_min":278.132,"temp_max":278.132,"sea_level":1003.75,"grnd_level":1003.42},"wind":{"speed":13.81,"deg":271.502},"rain":{"3h":1.0725},"clouds":{"all":76},"dt":1484169997,"sys":{"message":0.0028,"country":"DE","sunrise":1484119847,"sunset":1484147806},"id":8051091,"name":"Fehmarn","cod":200}
The error Unity displays is the following :

Code: [Select]
JSON root object has multiple properties. The root object must have a single property in order to create a valid XML document. Consider specifing a DeserializeRootElementName.
HutongGames.PlayMaker.Actions.ConvertJsonStringToXmlNode:ConvertFromJsonString() (at Assets/PlayMaker DataMaker/Json/Actions/ConvertJsonStringToXmlNode.cs:102)
HutongGames.PlayMaker.Actions.ConvertJsonStringToXmlNode:OnEnter() (at Assets/PlayMaker DataMaker/Json/Actions/ConvertJsonStringToXmlNode.cs:62)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:201)
HutongGames.PlayMaker.FsmState:OnEnter() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:169)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2603)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2561)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2489)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2619)
HutongGames.PlayMaker.Fsm:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1865)
PlayMakerFSM:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:501)

The API offers direct XML , but I cant get it to work since it is formatted pretty weird and I cant get XPath to work there. I am gonna paste a quick example of the XML returns, if someone can tell me how to navigate to the values it would render my above question answered :

Code: [Select]
<city id="8051091" name="Fehmarn">
<coord lon="11.19" lat="54.44"/>
<sun rise="2017-01-11T07:30:47" set="2017-01-11T15:16:47"/>
<temperature value="278.132" min="278.132" max="278.132" unit="kelvin"/>
<humidity value="94" unit="%"/>
<pressure value="1003.42" unit="hPa"/>
<speed value="13.81" name=""/>
<direction value="271.502" code="W" name="West"/>
<clouds value="76" name="broken clouds"/>
<precipitation value="1.0725" mode="rain" unit="3h"/>
<weather number="500" value="light rain" icon="10n"/>
<lastupdate value="2017-01-11T21:33:21"/>

Thanks in advance guys, I would really appreciate any kind of help!

Playmaker Help / Re: [Android] "Get Location Info" does not work
« on: November 18, 2016, 10:24:31 AM »
Oh wow. I solved it. I treated the "Get Location" function as a function that auto updates. What a stupid mistake. Sorry for the bothering, it now works perfectly fine!

Playmaker Help / Re: [Android] "Get Location Info" does not work
« on: November 18, 2016, 07:57:18 AM »
They are on the screenshots but they dont show on this forum since they are wider than the board's width  :P .

The actions are really just "Startup Location Services" and "Get Location Info".

If that does not help I will pack up the project once I am at home. Thanks in advance!

Playmaker Help / [SOLVED] "Get Location Info" does not work
« on: November 17, 2016, 03:19:56 PM »
Hello Playmaker Community!

I am working on an app that is based on GPS location and uses to determinate wether the user is in a designated area or not.

The core functionlaity of this project heavily depends on "Location Info" , therefore the action "Device/Get Location Info" is used to detect the Latitude and Longitude.

I start with an init state that starts the location service. I want it to try for 30 seconds - if it fails it pauses and restarts the initialization. This is the State that is supposed to do it :

The problem is that the State instantly triggers the "Location Services Failed" transition. I tried it with a GPS faker, ran it via Unity Remote 5 on a Lolipop Android device and built the app and gave it permission to use the Location services - to no avail.

The next step would be to save the Location info and sync it to geojson and detect if they match a certain area - but it never reaches this state :

I am desperately trying to figure out what could be causing it - I tried the updated actions i found on the forum somewhere (a 2013 post) , but I doubt that they are not updated in the Playmaker 1.8.3 I am using in my project.

Am I missing something Action-wise ? Or is it some project setting I am missing out on ?

Any kind of help would be greatly appreciated!
Best Regards

Pages: 1 [2]