Sign in to follow this  
Followers 0
Metexigma

Beginner, need help with an array

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



I tend not to like to go to forums, due to code snipers, but I personally don't mind, due to being a beginner lol

Share this post


Link to post
Share on other sites

show your full script and use codetags "<>" for posting script.


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.

Share this post


Link to post
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
 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

Crap, sorry. I'm kind of a beginner, I didn't mean to break the rules. So you're unable to help me?

 

Share this post


Link to post
Share on other sites

Also, if you can help me, my problem was "a2", not the actual Name.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0