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

Username:   Password: 
 RegisterRegister   
 Questions about "Include" command
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Blank




PostPosted: Wed Jul 28, 2004 1:26 pm   Post subject: Questions about "Include" command

alright.. this is what i'm trying to do..

i made a save feature on my rpg, and it works fine, when they want to save it creates a file with all the character stats with an account and password to login.
later when they reload the game they enter the account and password and it loads their character exactly where they were before.

the problem is, it gives me an error if i try to include a file on a site. how can i include files on sites??
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jul 28, 2004 1:34 pm   Post subject: (No subject)

include works at compile time only. It is for organizational purposes only.

to do save games, you'd have to read / write to a data file
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Blank




PostPosted: Wed Jul 28, 2004 2:01 pm   Post subject: (No subject)

fair enough, but i tried read/write as well, and it gave me a location error

i put the path name as something like "http://www.fakesite.com/test.txt" and it said could not open
C:/blah/location of the turing file/http://www.fakesite.com/test.txt"
Mazer




PostPosted: Wed Jul 28, 2004 2:46 pm   Post subject: (No subject)

Reading and writing is for local files. If you want to get a file hosted on the net, you'll need to use Turing's net commands, though I'm not sure if you can write to a file on a server with it.
Blank




PostPosted: Wed Jul 28, 2004 4:46 pm   Post subject: (No subject)

ok so then, is it possible somehow to have an account storage on a site? so that when they run the game they enter an account lets say..

Account1
Password1

then it reads from the site and sets all the variables for that account

then when they save it remakes the file with the new variable values?


(i just need to know if it's possible, and how, not a detailed explanation, because i already know how to do that with local files)
Tony




PostPosted: Wed Jul 28, 2004 5:54 pm   Post subject: (No subject)

you're going to need to write to server's file somehow. i'm not sure to what extend turing's Net. module is useful or how serverside permissions work...

it might be easier to have a serverside script running that would update the files. in PHP perhaps. You can pass parameters to the PHP script from the turing by assembling together a proper URL to be accessed
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Wed Jul 28, 2004 7:35 pm   Post subject: (No subject)

TRY THIS OUT!

u can read the content of .html files (read the code) with turing..

code:

var netStream, linecount : int
linecount := 0
var line : string
var list : array 1 .. 2000 of string
netStream := Net.OpenURLConnection ("http://www.fakesite.com/test.txt"  )
loop
    get : netStream, line
    put line
        linecount += 1
        list (linecount) := line
    exit when eof (netStream)
end loop
Net.CloseConnection (netStream)
put "This Is All The Info From That Webpage!"
for a : 1 .. linecount
    put list (a)
end for


instead of opening index.html.. just open test.txt.. this should theoreticallly work..
zylum




PostPosted: Thu Jul 29, 2004 10:01 pm   Post subject: (No subject)

short1 > its easy to read the html text but to write it is another story...

i definitetly think php is the way to go though... ask amailer, he knows php (i think)
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Thu Jul 29, 2004 11:41 pm   Post subject: (No subject)

ask octpi.. since he is the mod..
Tony




PostPosted: Fri Jul 30, 2004 12:28 am   Post subject: (No subject)

when was the last time octopi was around? I haven't seen him for quite a while Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Fri Jul 30, 2004 8:16 pm   Post subject: (No subject)

its simple.. i dont think turing can WRITE a file to the net..

but maybe if u can figure it out..... BadBlue hs remote file uploading... if u eneable it.. u can let other ppl from anywehre in the world upload a file to ur PC..by going to ur badblue page and using the 'upload file' button....(to a designated folder onto ur pc) and if the same file uploaded twice u can have it to update the previous one....

maybe get turing to write a file (to c:\\turingsaved.exe).. then open a webpage lets say..


if not Sys.Exec ("http://ur_ip_addy/upload.php?file=c:\\turingsaved.txt") then
end if

and maybe that will work to upload the file to ur computer erasing the old version of it...


/upload.php?file= i just pulled outa my ass.... i dont know what the real command is.and/or file name.... but if u could figure it out and if there is somethign like that... that would work perfectly in ur situation... and u can get amailer or octopi to get the right upload.php?file= command thingy.....


but i can try to help u in that route cuz i have badblue installed and all..and can help u set it all up etc..... but ud need to have it installed to test the theory cuz i can no longer upload (i past the 30 or w/e dayz)... but i can still download so i kept it...

BadBlue is a webserver thats free (well for first 30 or 60 days)

www.badblue.com


hope that may help.../
DanShadow




PostPosted: Fri Jul 30, 2004 8:45 pm   Post subject: (No subject)

Just in case 'Blank' still wanted to know, here is how you use include:
code:

%Top of Code%
include "c:/program files/turing/savefile.t"

This would include code saved under the filename "savefile.t" into your program from the destination "c:/program files/turing/".
Delta




PostPosted: Thu Aug 05, 2004 11:47 am   Post subject: (No subject)

Anyways... why would you need to store it on the net... like I'm sure it'd be kewl... but dude... just store it on the local computer... if you don't want ppl cheatin' and editing the files... encrypt it.
the_short1




PostPosted: Fri Aug 06, 2004 11:06 am   Post subject: (No subject)

but then the highscores etc wont be updated... ppl will manually have to tell u (like for my pacman game) and then u have to recompile....


i think i got how to do it for badblue.....

i isolated it within 15 lines of code... its a form thingy in HTML...

i not that good in html so i dont know...
.

its all about upload.dll...

and their is a forminput variable.. if u can auto make that into a file name then BAM.. ur done...


and if that cant be figured out....

well... u can make a smaller file from within turing with the new high scores (encryted), then just ask the user to upload that file using the little upload file pag.e... then u can uncrypt and ad the new high scores to the highscores file thats hosted on the net.... still better then re compiling..
the_short1




PostPosted: Fri Aug 06, 2004 11:09 am   Post subject: (No subject)

no matter what, host ur highscores file on the net and get turing to read it.... that way u ont need encryption at all.. and it can be updated without hving to recompile the whole program!!!!
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 2  [ 22 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: