Skip to content

Commit

Permalink
changed array indices for JSON data returned from the members API and…
Browse files Browse the repository at this point in the history
… added some more robust error handling, fixes issue #3
  • Loading branch information
snicker committed Nov 25, 2014
1 parent f696e31 commit bf5af3d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions habitrpg.au3
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ Global $growlHandle = _GrowlRegister($growlAppName,$growlNotifications,@ScriptDi

Dim $gold_gained = 0, $xp_gained = 0, $original_gold = -1, $original_xp = -1;

Dim $userdata = HRPG_Get_Member($habitRpgUID,$habitRpgUID,$habitAPIToken)[2][1]
Dim $userdata = HRPG_Get_Member($habitRpgUID,$habitRpgUID,$habitAPIToken)[3][1]
If $userdata <> "" Then
$original_gold = $userdata[4][1];
$original_xp = $userdata[3][1];
If UBound($userdata) > 4 Then
$original_gold = $userdata[4][1];
$original_xp = $userdata[3][1];
Else
_GrowlNotify($growlHandle,"notice","Error!","Couldn't get your current gold and XP. If this persists, file a bug report!")
EndIf
EndIf

Dim $response = HRPG_Score_Task($habitRPGTask,$habitRpgDirection,$habitRpgUID,$habitAPIToken)
Expand Down

0 comments on commit bf5af3d

Please sign in to comment.