Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Grabbing information help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nemo296




PostPosted: Sat Feb 20, 2010 8:52 am   Post subject: Grabbing information help

What is it you are trying to achieve?
Create a calculator that grabs information from the internet/a website.

What is the problem you are having?
I can't figure out how turing grabs information from the internet (If that's even possible)

Describe what you have tried to solve this problem
I looked in the turing help thing, the index search too.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


const COSMIC := 120 %<------ Trying to grab this information from the internet.
const DEATH := 375 %<------ Trying to grab this information from the internet.
const BLOOD := 377 %<------ Trying to grab this information from the internet.
const SOUL := 243 %<------ Trying to grab this information from the internet.
const LAW := 279 %<------ Trying to grab this information from the internet.
const MIND := 5 %<------ Trying to grab this information from the internet.
const NATURE := 234 %<------ Trying to grab this information from the internet.

var COSTOFB, COSTOFBE, RUNE : int := 0
var BOLT, BOLT2, STARTOVER : string
var TOTAL : real := 0
var KEY : string (1)
var DONOTDO : boolean := false


put "Hi, this is a program to help you figure out what your hourly wages are for enchanting any bolt."

put ""

put "Press any key..."

getch (KEY)

put ""

proc Program

    put "What type of bolt are you enchanting?"
    get BOLT


    if Str.Lower (BOLT (1 .. 2)) = "ru" then
        RUNE := DEATH
        COSTOFB := 766 %<------ Trying to grab this information from the internet.
        COSTOFBE := 842 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "on" then
        RUNE := BLOOD
        COSTOFB := 8723 %<------ Trying to grab this information from the internet.
        COSTOFBE := 8852 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "dr" then
        RUNE := SOUL
        COSTOFB := 6936 %<------ Trying to grab this information from the internet.
        COSTOFBE := 7179 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "di" then
        RUNE := LAW
        COSTOFB := 1551 %<------ Trying to grab this information from the internet.
        COSTOFBE := 1669 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "op" then
        RUNE := 0
        COSTOFB := 15 %<------ Trying to grab this information from the internet.
        COSTOFBE := 26 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "sa" then
        RUNE := MIND
        COSTOFB := 107 %<------ Trying to grab this information from the internet.
        COSTOFBE := 148 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "ja" then
        put "Cannot find Jade"
    elsif Str.Lower (BOLT (1 .. 2)) = "pe" then
        RUNE := 0
        COSTOFB := 77 %<------ Trying to grab this information from the internet.
        COSTOFBE := 95 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "em" then
        RUNE := NATURE
        COSTOFB := 482 %<------ Trying to grab this information from the internet.
        COSTOFBE := 558 %<------ Trying to grab this information from the internet.
    elsif Str.Lower (BOLT (1 .. 2)) = "re" then
        RUNE := 0
        COSTOFB := 91 %<------ Trying to grab this information from the internet.
        COSTOFBE := 95 %<------ Trying to grab this information from the internet.
    else
        put "That bolt does not exist"
        DONOTDO := true
    end if

    put ""

    if DONOTDO = false then

        TOTAL := ((((COSTOFBE * 10) - (COSTOFB * 10)) - COSMIC - RUNE) * 1400) / 1000

        put "You will make ", TOTAL, "k/h making ", BOLT, " bolts."

    end if

    put ""

    put "Do you wish to use this again? y or n..."
    get STARTOVER
    put ""

end Program

loop
    Program
    exit when Str.Lower (STARTOVER (1)) = "n"
end loop

if Str.Lower (STARTOVER (1)) = "n" then
    put "Thanks for using Nemo2966's bolt enchanter Calculator."
    put "I hope you enjoyed."
end if




Please specify what version of Turing you are using
4.1 and 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Sat Feb 20, 2010 11:15 am   Post subject: RE:Grabbing information help

Well, you can use turing's net library to grab stuff (maybe, idk) it's documented in the help file. If you aren't grabbing plain-text, you're going to have to parse it though.
Turing_Gamer




PostPosted: Sat Feb 20, 2010 3:02 pm   Post subject: Re: Grabbing information help

Is this runescape?
USEC_OFFICER




PostPosted: Sat Feb 20, 2010 6:48 pm   Post subject: RE:Grabbing information help

Looks like it. Plus it says the hourly rate for enchanting blots and has all the runes for it. Sounds like Runescape to me.
SNIPERDUDE




PostPosted: Sat Feb 20, 2010 10:42 pm   Post subject: RE:Grabbing information help

All the runes sound right.
Also, doesn't runeHQ have all those calculators?
USEC_OFFICER




PostPosted: Sun Feb 21, 2010 4:31 pm   Post subject: RE:Grabbing information help

It actually looks like they don't. They should get one. Seems easy enough. Unlike the level calulators, the information is all there, just need an equation. (Can't spell)

PS: Unless we actually answer the guy's question, this will probably get moved to Off Topic.
TheGuardian001




PostPosted: Sun Feb 21, 2010 5:08 pm   Post subject: Re: Grabbing information help

Well, it would probably be easier for them to simply hard code the values in. Retrieving information from the contents of a webpage is a pretty complicated thing to do, and Turing's Net commands really aren't built for anything outside of basic data streaming.

Unless you can find somewhere that hosts the data needed in a text file, I wouldn't even bother trying this in Turing.
SNIPERDUDE




PostPosted: Sun Feb 21, 2010 7:53 pm   Post subject: RE:Grabbing information help

I believe retrieving price information for runes is especially difficult, everything is in java on Runescape's site - so accessing something like the GE would be an obstacle not really worth the fight.
Maybe a quick menu that allows the user to enter (into text boxes provided) the prices of each.
Sponsor
Sponsor
Sponsor
sponsor
USEC_OFFICER




PostPosted: Sun Feb 21, 2010 9:29 pm   Post subject: RE:Grabbing information help

Either that or switch to Java and see if Runescape will allow you to get the prices of their website. You could also factor in the rising or lowering prices. They have that on their website.
SNIPERDUDE




PostPosted: Sun Feb 21, 2010 10:00 pm   Post subject: RE:Grabbing information help

Well, this is where they'd have to grab it from.
mirhagk




PostPosted: Mon Feb 22, 2010 11:46 pm   Post subject: RE:Grabbing information help

Theoritically this could be done, have the url (after the item being searched), get the data for that url using Net.OpenURLConnection and then just know exactly where you have to look to get the price value. It'd work alright as long as runescape didn't change the way their website worked (I believe there are tons of sites that do this process, just with javascript or something instead).

Also to be honest I never actually tried to Net.OpenURLConnection successfully, kinda tried once but it didn't work.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: