generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Search through catalog in a script

Previous Thread :: Next Thread 
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 07:33 PM
I am trying to make a script that searches through the catalog for a specified string.

EX:

"Heal"

It'll search through the catalog until something with the string "Heal" in it pops up. Is there a good way to do this?
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 07:40 PM
b

It'll obviously use marketplaceservice.
Report Abuse
Cuyler is not online. Cuyler
Joined: 27 Feb 2006
Total Posts: 3784
23 Apr 2016 07:45 PM
Use a HTTP Proxy and the Catalog API.

http://wiki.roblox.com/index.php?title=Catalog_API


Report Abuse
DevConsole is not online. DevConsole
Joined: 02 Jun 2008
Total Posts: 460
23 Apr 2016 07:58 PM
http://wiki.roblox.com/index.php?title=Catalog_API#Query_object

for your particular example it'd be something like:

roblox.com/catalog/json?Keyword=Heal

You can use other query objects such as Category, Subcategory, etc. to narrow down your search.

For example, if you know it's a gear, then you could do this:

roblox.com/catalog/json?Keyword=Heal&Category=5 -- 5 is the enum for gear.

Couple this API with the HttpService :GetAsync() and :JSONDecode() methods.






Report Abuse
DevConsole is not online. DevConsole
Joined: 02 Jun 2008
Total Posts: 460
23 Apr 2016 08:00 PM
Note: If you are going to be reading data from items such as the Name and displaying it keep in mind that sometimes it's a little iffy and replaces some characters with HTML numbers. For example, it may replace an apostrophe with the HTML number "& # 3 9;" (no spaces - roblox filtering). When I was working on a modern-style catalog GUI my work-around for this was to create a table with all the translation from the HTML numbers to it's respective symbol, and then loop the :GetAsync() returned data and check if there are any HTML numbers from my table in the returned JSON table, and if found then use the method string.gsub() to replace it with the corresponding symbol. The reason I do this before using :JSONDecode() is because when you :GetAsync() a JSON table it's given as string. So I just conveniently use that to my advantage.






Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 08:04 PM
Thanks!
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 09:26 PM
So far, I have this: local Data = game:GetService("HttpService"):GetAsync("https://search.roblox.com/catalog/json?Keyword="..Msg3.."&Category=5", false)
Data = game:GetService("HttpService"):JSONDecode(Data)

Would the Data be a table? and could a reference it like Data["Name"]?

Thanks!
Report Abuse
DevConsole is not online. DevConsole
Joined: 02 Jun 2008
Total Posts: 460
23 Apr 2016 09:31 PM
Yes, just keep mind about the html numbers thing. It's been a while but the structure for the data is like:

Data = {{['Name'] = "", ['AssetId'] = 0},{['Name'] = "", ['AssetId'] = 0}};

All the data for each item returned from your query is inside an unnamed table inside one "master" table. So to check for specific things you'd need to parse your Data variable with a for k,v in next loop and use an if statement or something similar. There's more data per item aside from Name and AssetId, that was just an example.


Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:02 PM
My Http trust check failed? Lemme double check that my http is turned on

Thanks again for all of your help!
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:03 PM
Yup it's turned on

Will I have to use a proxy like HideMy(Other word for butt).com?
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:27 PM
Nvm, The Adress was screwed up :P
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:29 PM
Nvm again... Still trust check failed..
Report Abuse
DevConsole is not online. DevConsole
Joined: 02 Jun 2008
Total Posts: 460
23 Apr 2016 10:32 PM
HttpService cannot make requests directly to www.roblox.com you have to tunnel your requests through a proxy.


Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:39 PM
i'll use .prx.proxyunblocker.org thanks so much for all of your help!
Report Abuse
LuaLlama is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
23 Apr 2016 10:46 PM
They blocked that too :P
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image