Jump to content

Beginner, need help with an array


 Share

Recommended Posts

So, what I need help with, is adding 2 arrays together, from a JSON file, and well.. the script explains itself. But my problem is, "$PriceInJSON" is always just showing as blank, or a number. I.E. " blank, blank, 250, blank, 400, blank " because it's a currency, but it's making it a bitch to go just $PriceInJSON[2]. So, anybody have help?
 
Notice: I'm an Autistic 16 year old, that has just started autoit, but has a background in Java, C++, Lua, and HTML. Sorry I'm not great with words.
 
Func SpliceArray($a1, $a2)
 Global $FinalTable[UBound( $a1 )]
 ;_ArrayDisplay($a2)
 For $i = 0 To UBound( $a1 ) Step 1
  ;MsgBox(0, '', $a2[$i])
  Local $Find = _ArraySearch($a2, '')
  ;MsgBox(0, 'Title', $Find)
  If $Find == Null Then
   $FinalTable[$i] = ($a1[$i] & $a2[$i])
  Else
   $FinalTable[$i] = $a1[$i]
  EndIf
 Next
 Return $FinalTable
EndFunc


While 1
 Local $NewJSON = _INetGetSource($HatsLink)
 If Not ($NewJSON == $LastJSON) Then
  ;Sleep(60 * 1000)

  $NewJSON = _INetGetSource($HatsLink)
  ;$NewJSON = StringReplace($NewJSON, $LastJSON, '') ;Get all the new items
  $NameInJSON = _StringBetween($NewJSON, '"Name":"', '"')
  $PriceInJSON = _StringBetween($NewJSON, '"Price":"', '"')
  $AssIDInJSON = _StringBetween($NewJSON, '"AbsoluteUrl":"', '"')

  $SplicedArray = SpliceArray($NameInJSON, $PriceInJSON)
  _ArrayDisplay($SplicedArray, 'New has appeared!')
  ;_ArrayDisplay($PriceInJSON, 'Tits fly away with you 2')
  $LastJSON = _INetGetSource($HatsLink)
 EndIf

 Sleep($Frequency * 100)
WEnd

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

Here you are -- thank you by the way.

#include <IE.au3>
#include <INet.au3>
#include <String.au3>
#include <Array.au3>
Func captureEsc()
 Switch @HotKeyPressed
  Case '{`}' ; String is the {PAUSE} hotkey.
   Exit
  EndSwitch
EndFunc
HotKeySet('{`}', 'captureEsc')
Local $HatsLink = ( 'https://search.roblox.com/catalog/json?Subcategory=17&SortType=3&IncludeNotForSale=true' )
Global $LastHatsJSON;
Local $GearLink = ( 'https://search.roblox.com/catalog/json?CatalogContext=1&Subcategory=5&SortAggregation=5&IncludeNotForSale=true&LegendExpanded=true&Category=5' )
Global $LastGearJSON;
Local $FaceLink = ( 'https://search.roblox.com/catalog/json?CatalogContext=1&Subcategory=10&SortAggregation=3&LegendExpanded=true&Category=4' )
Global $LastFaceJSON;
Local $LastJSON
Local $Frequency = 5 ; Every x seconds it checks
Local $ShitPostCheck = 100; ; How many seconds until we're clear
;Func SpliceArray($a1, $a2)
; Global $FinalTable[UBound( $a1 )]
; ;_ArrayDisplay($a2)
; For $i = 0 To UBound( $a1 ) Step 1
;  ;MsgBox(0, '', $a2[$i])
;  Local $Find = _ArraySearch($a2, '')
;  ;MsgBox(0, 'Title', $Find)
;  If $Find == Null Then
;   $FinalTable[$i] = ($a1[$i] & $a2[$i])
;  Else
;   $FinalTable[$i] = $a1[$i]
;  EndIf
; Next
; Return $FinalTable
;EndFunc
Func PingLink($Link, $Ping)
 Local $NewJSON = _INetGetSource($Link)
 ;_ArrayDisplay($NewJSON, 'Item Updated!')
 If Not ($NewJSON == $Ping) Then
  Sleep(10 * 1000)
  $NewJSON = StringReplace($NewJSON, $LastJSON, '') ;Get all the new items
  $NameInJSON = _StringBetween($NewJSON, '"Name":"', '"')
  $PriceInJSON = _StringBetween($NewJSON, '"Price":"', '"')
  $AssIDInJSON = _StringBetween($NewJSON, '"AbsoluteUrl":"', '"')
  For $i = 1 To UBound( $NewJSON ) Step 1
   $Answer = MsgBox(3, 'Item Updated! Would you like to go to the link?', $NameInJSON[$i])
   If $Answer == 6 Then ; Yes
    ShellExecute($AssIDInJSON[$i])
   EndIf
  Next
  ;_ArrayDisplay($NameInJSON, 'New has appeared!')
  $LastJSON = _INetGetSource($Link)
 EndIf
EndFunc
While 1
 PingLink($HatsLink, $LastHatsJSON)
 PingLink($GearLink, $LastGearJSON)
 PingLink($FaceLink, $LastFaceJSON)
 Sleep($Frequency * 100)
WEnd
 
Link to comment
Share on other sites

click here

Row|Col 0
[0]|Golden Super Fly Boombox
[1]|Red Rolling Hoverboard
[2]|Body Swap Potion
[3]|Redcliff Wings
[4]|8-Bit Blaster
[5]|Gravity Coil
[6]|Attack Doge
[7]|Speed Coil
[8]|Bombo\u0026#39;s Survival Knife
[9]|Korblox Mage Staff
[10]|Pompous, the Cloud
[11]|RoVacuum 2012
[12]|Heat Seeking Missile Launcher
[13]|Boombox Gear 3.0
[14]|8bit Duck Friend
[15]|Sword of Ancalagon
[16]|Mr. Whiskers
[17]|Galactic Laser Gun
[18]|Rainbow Disco Hyperbike with Sidecar
[19]|Sword of the Epicblueness
[20]|Sword of the Epicredness
[21]|Dubstep Boombox
[22]|Phoenix
[23]|Navy Convertible
[24]|Orinthian Electroslasher
[25]|Katana
[26]|Ultimate Drive Speedster
[27]|Viridian Hoverboard
[28]|Green Balloon
[29]|Spray Paint
[30]|Rainbow Magic Carpet
[31]|Orinthian Winged Jet Pack
[32]|Red Hyperlaser Gun
[33]|Korblox Deathspeaker\u0026#39;s Spell Book
[34]|Flying Reindeer
[35]|Robot Guard Dog
[36]|Mythic Sword of the West Wind
[37]|Astral Cloak of Transportation
[38]|Wizards of the Astral Isles: Pegasus
[39]|Overseer Crossbow
[40]|Dual Golden Super Fly Boomboxes
[41]|Mad Murderer Knife

 

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Link to comment
Share on other sites

  • Jos locked and unlocked this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...