Print Page | Close Window

Help a Tech Noob

Printed From: Illyriad
Category: Miscellaneous
Forum Name: Technology & data
Forum Description: Discussions on data dumps, downloads, and third party applications.
URL: http://forum.illyriad.co.uk/forum_posts.asp?TID=10809
Printed Date: 16 Apr 2024 at 07:14
Software Version: Web Wiz Forums 12.03 - http://www.webwizforums.com


Topic: Help a Tech Noob
Posted By: Jejune
Subject: Help a Tech Noob
Date Posted: 26 Jun 2020 at 21:22
Hello, my tech dudes and dudettes.

As you know, Digi and I have built an alliance algorithm using the game's data feeds. I've stated before that I am a tech mortal, and thus decided to build our algorithm in a Google Sheet because that platform is about the extent of my tech abilities. So, that's why we've built it where we've built it.

The good news is that it is working wonderfully. We're currently working on building in a new dimension that takes into account the races of alliance leaders.

I've run into a snag, however, and am wondering if you can help me with it.

We generally use IMPORTXML in Google Sheets. We'll do one column with //playername, another with //playernameid/@id, etc., using XPATH queries. This has worked great. 

However, there is a quirk with the Player Feed. If a player isn't in an alliance, they have no alliance role ID. Example, Kumo:

<player>
<playername id="10">Kumomoto</playername>
<allianceid id="0"/>
<race id="2"/>

KillerPoodle, on the other hand:

<player>
<playername id="17">KillerPoodle</playername>
<allianceid id="1"/>
<allianceroleid id="4"/>
<race id="1"/>

So, when I send the //allianceroleid/@id" data down a column next to players' names and other IDs, the data gets out of sync, because not everyone has an alliance role id.

Is there any way to tell IMPORTXML to insert a zero in place of where the alliance role ID returns whenever it confronts a player with no alliance role ID?

If not, can you think of any other way to address this? I'm kind of stumped.

Thanks!

JJ




-------------
https://elgea.illyriad.co.uk/a/p/394156" rel="nofollow">



Replies:
Posted By: Jejune
Date Posted: 27 Jun 2020 at 15:42
Good news -- I worked it out!

Since all players not in an alliance have an alliance ID of zero, I did a FILTER from one sheet to another where the alliance rank column had to be >0. From there, I ran the alliancerole ids alongside that filtered list and it matched perfectly. Yay!


-------------
https://elgea.illyriad.co.uk/a/p/394156" rel="nofollow">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 - http://www.webwizforums.com
Copyright ©2001-2019 Web Wiz Ltd. - https://www.webwiz.net