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

Username:   Password: 
 RegisterRegister   
 Importing Modules
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Aange10




PostPosted: Tue Sep 20, 2011 6:41 pm   Post subject: RE:Importing Modules

So why doesn't
Turing:

type PlayerData:
    record
        xpos: int
        ypos: int
        xpos_width: int
        xpos_height: int
        color1: int
        jump_speed: real
        run_speed: real
    end record
var new_data, old_data : PlayerData

% init all values
old_data.xpos := 0
old_data.ypos := 0
% ... etc.

function do_stuff_to(local_data : PlayerData)
    local_data.ypos += 1
    local_data.xpos_width += 1
    % etc...
    result local_data
end do_stuff_to

new_data := do_stuff_to(old_data)

work? And how do i fix it
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Sep 20, 2011 7:16 pm   Post subject: RE:Importing Modules

follow what the compiler tells you when you try to run this code. Also
Zren @ Tue Sep 20, 2011 1:53 am wrote:
You can't modify variables passed as parameters in Turing...
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Aange10




PostPosted: Thu Sep 22, 2011 8:33 pm   Post subject: Re: Importing Modules

Thanks a ton guys. I got frustrated and took a break for a few days, and I've come back with a clear mind and figured it out(: .. Much thanks!! (Really don't know where I'd be without you!)


Here is the code



Functions output records.T
 Description:
A function that outputs a record

Download
 Filename:  Functions output records.T
 Filesize:  1.02 KB
 Downloaded:  69 Time(s)

Aange10




PostPosted: Mon Sep 26, 2011 8:06 pm   Post subject: RE:Importing Modules

Hmmm, out of everything I've been doing I didn't figure I'd be asking this question.. but..

How can i make a string take in more than one word? If i type "Hello World" it will only show "Hello".

I've actually read all the tutorials, used the turing help and tried to search the forums (3000 posts t-t) for this problem.

Anybody have an answer as to how to do this?
DemonWasp




PostPosted: Mon Sep 26, 2011 10:27 pm   Post subject: RE:Importing Modules

This question gets asked about once a week, so I'm surprised it doesn't show up in search results:

get my_variable : *

that :* tells "get" to "get everything up to the end of line". Otherwise, get assumes you want to get just up to the first space.

You can read about this in the Turing help on the get command.
Aange10




PostPosted: Mon Sep 26, 2011 10:59 pm   Post subject: RE:Importing Modules

Thankyou demon! And yes, I suppose I didn't check get, only string... =/ Sorry about that; I didnt think that get would have a specific syntax/parameter for strings w/ spaces
Aange10




PostPosted: Mon Sep 26, 2011 11:31 pm   Post subject: Re: Importing Modules

I've run into another hindrance... Although this one may be a bit over my head; I'm working on a program that I can put information into and it will format it for me. (Ughh, all the work, so much easier to program it(: ) The file is at the bottom here [VERY self explanatory. The file is written simply, and I have no need to make it more compact; it will never be used for another purpose/ or be expanded on.]

I've come to a problem. The program works (and does quite well). However, to make my life easier, I'd like to have it paste the information it gives me straight into a .docx file. [Why copy and paste when I can make the computer do it for me?] My problem, though, is that when i try to do this it corrupts my .docx file. Is there anything I can do about this? Does it happen in most languages, or is turing just lame? Here is the example coding I was using to test.

Turing:

var ws_doc : int
open : ws_doc, "wss.docx", put % I've already created this file and I located it in the same folder as the program is in.
put : ws_doc, "Blah blah blah" % I also went about putting a comma at the end of the "" and adding a variable there to see if I could input both in the same line. However that is irrelevant.
close : ws_doc


I also tried the above using the write command instead of the put commands, I had the same result.



Barnes WS.t
 Description:
Project

Download
 Filename:  Barnes WS.t
 Filesize:  3.66 KB
 Downloaded:  92 Time(s)

Nick




PostPosted: Tue Sep 27, 2011 7:38 am   Post subject: RE:Importing Modules

The issue is that docx files are not plain text, they are binary files. Unless you know the encoding for the format (which I'm sure you could Google but it'd be a hell of a lot easier to copy/paste) you can't really do this with turing.... come to think of it it still may not be possible as there are some characters that turing cannot handle...

tl;dr just copy/paste
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Tue Sep 27, 2011 7:54 am   Post subject: RE:Importing Modules

In particular, all of the Office Open XML (not to be confused with OpenOffice XML) formats are zipped file formats. That means that, to even read the underlying XML, you would need to implement unzipping in Turing.

Once you have that, you would have to read and understand the existing document. The specification for how to do this is about 6,000 pages long, as I recall.

Then you would have to modify the document, push it all out as XML and then zip it again.

Just use Word (or OpenOffice, or LibreOffice).
Aange10




PostPosted: Tue Sep 27, 2011 4:31 pm   Post subject: RE:Importing Modules

Alright thanks a ton you guys!
Aange10




PostPosted: Sun Oct 02, 2011 11:43 am   Post subject: RE:Importing Modules

I've been playing around a lot with having turing open/close things [internet explorers, executables, facebook.. etc.] and I've decided to try and write a tutorial on Turing about Turing because I want to help some of my friends learn the language.

However I'm running into the problem with them needing to run it with administrative privileges. Now, that isn't a problem [they trust me] but what is a problem is it's really annoying to right click and run as admin. Is there a way I can make it ask them for admin privledges when they run it? (Like the little popup window with the allow/disallow thing)


Do I do this in the coding of the program, or do i manually edit the properties of the .exe to 'run as admin'? (will it work when i send it to their computers?)
Nick




PostPosted: Mon Oct 03, 2011 10:36 am   Post subject: RE:Importing Modules

Right click turing.exe -> properties -> compatibility mode -> run this as an administrator
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 2 of 2  [ 27 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: