Computer Science Canada Questions about "Include" command |
Author: | Blank [ 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?? |
Author: | Tony [ Wed Jul 28, 2004 1:34 pm ] |
Post 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 |
Author: | Blank [ Wed Jul 28, 2004 2:01 pm ] |
Post 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" |
Author: | Mazer [ Wed Jul 28, 2004 2:46 pm ] |
Post 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. |
Author: | Blank [ Wed Jul 28, 2004 4:46 pm ] |
Post 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) |
Author: | Tony [ Wed Jul 28, 2004 5:54 pm ] |
Post 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 |
Author: | the_short1 [ Wed Jul 28, 2004 7:35 pm ] | ||
Post subject: | |||
TRY THIS OUT! u can read the content of .html files (read the code) with turing..
instead of opening index.html.. just open test.txt.. this should theoreticallly work.. |
Author: | zylum [ Thu Jul 29, 2004 10:01 pm ] |
Post 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) |
Author: | Andy [ Thu Jul 29, 2004 11:41 pm ] |
Post subject: | |
ask octpi.. since he is the mod.. |
Author: | Tony [ Fri Jul 30, 2004 12:28 am ] |
Post subject: | |
when was the last time octopi was around? I haven't seen him for quite a while ![]() |
Author: | the_short1 [ Fri Jul 30, 2004 8:16 pm ] |
Post 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.../ |
Author: | DanShadow [ Fri Jul 30, 2004 8:45 pm ] | ||
Post subject: | |||
Just in case 'Blank' still wanted to know, here is how you use include:
This would include code saved under the filename "savefile.t" into your program from the destination "c:/program files/turing/". |
Author: | Delta [ Thu Aug 05, 2004 11:47 am ] |
Post 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. |
Author: | the_short1 [ Fri Aug 06, 2004 11:06 am ] |
Post 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.. |
Author: | the_short1 [ Fri Aug 06, 2004 11:09 am ] |
Post 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!!!! |
Author: | Dan [ Sat Aug 07, 2004 12:50 am ] |
Post subject: | |
If you use a method to upload the sorces to the web using php on the server side like most porgames i have seen that do this do. It will be very easy to post fake sorces since poleop could just figger out the protocal u are using to send the data and then send fake data to the php script. |
Author: | the_short1 [ Sat Aug 07, 2004 12:13 pm ] |
Post subject: | |
not if they dont know it.. if turing ran the script... and the turing code was compiledf... ud never know... |
Author: | Dan [ Sat Aug 07, 2004 5:10 pm ] |
Post subject: | |
shure you could, just use a patch sinffer and you could see all the netwrok infomaiton leavling and going on your network. It whould be very easy to do. |
Author: | Paul [ Sat Aug 07, 2004 11:45 pm ] |
Post subject: | |
tony wrote: 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 so that means it only works if the main exe is compiled and it won't work just by running the .t file with the includes in it? if so, I've wasted massive amounts of time trying to get the include to work for me lol... |
Author: | Tony [ Sun Aug 08, 2004 2:24 am ] |
Post subject: | |
Paul Bian : include works just one time - when you compile the program (or run the .t source). the main issue here that many fail to understand is that turing is not an interpriter language (well... the way it compiles it kind of is... but that's details). Point is, turing produces a standalone .exe and modiflying the included .t sources after the file is compiled (or while parent .t source is running) will not affect the execution of the program. |
Author: | the_short1 [ Mon Aug 09, 2004 10:46 am ] |
Post subject: | |
ok... well were all not networking ... ergm... whats the word ..... so yea... hell i dont even know whats a networking sniffer is.. anyways.. think of files u include as like gUI when u go import GUI its basically the same as include 'hello.t' once u make the .exe, both files are no longer needed... but u se... u can only include a file once.... so it kind of sucks say u have a file called 'clear screen method.t' and u want it to run at the start of u game and at the end... include 'clear screen method.t' %% game here %end of game include 'clear screen method' wont work... using turing units is much clearner and better way..... even if u only need to include it once.. it still is better... instead... u just make a proc callled main or w.e and make the file a turing unit.. then import 'clearscreenmethod.t then to use it all u need to do is clearscreenmethod.main and u can do that over and over again for help u can pm me... or delos... |
Author: | Mazer [ Mon Aug 09, 2004 3:19 pm ] | ||||
Post subject: | |||||
No, not really. I could technically include a file as many times as I want, depending on what the file contains (IIRC). Suppose I had a file "includethis.t" which contains the following
And for whatever reason, you needed that code in your program. then you would have,
And if you want it included again, you should be able to do it. The problem is when you have things like variables and procedures/functions declared in the file you're trying to include, because you can't declare the same variables twice. It's the same for C++ except you can use preprocessor directives (I'm pretty sure that's what they are called) so that if you want to include a file several times, the main code of the file is only compiled once. |