Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: MicroWorlds Forum <mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: MIA, Ask an Expert: write to a file
From: Rotem Kimchi <rotemk2@xxxxxxxxxxxxxxxx>
Date: Mon, 8 Nov 2010 01:46:04 +0200

That did the job …



But after some thinking I understood it's no good for my needs.



I need to create a date base that remember and handle the files.

There for I need to keep the count "alive" even after the program is turn
off, and for that purpose I found crateprojectvar useful.

But again I encounter a problem in increasing its value.

I think I did everything I should have but the counter does not increase and
only one file is created

or gives the next statement

i has no value in Robot_Moves

 here is the relevant parts



TO STARTUP

.

.

.

*createprojectvar "i*

*seti 0*



.

End



Robot moves

.

.

.

if :arrows = 38 [Robo, seth 0 fd :step

talkto "SaveFile print se [seth 0 fd ]:step

savetext (word "command :i ".txt)] ;

*seti i + 1 ;*

*.*

*.*

*.*

*end*

**

*thanks again*

2010/11/7 Daniel Ajoy <da.ajoy@xxxxxxxxx>

> On Sun, 07 Nov 2010 14:02:47 -0500, Rotem Kimchi <rotemk2@xxxxxxxxxxxxxxxx>
> wrote:
>
> I started with exporttext but it didnt work
>> your advie is much batter but i didnt succeeded on implement it
>> i tried
>>
>> if :arrows = 40 [Robo, seth 180 fd :step
>> talkto "commands print sentence [seth 180 fd ]:step
>> talkto "SaveFile print sentence [seth 180 fd ]:step
>> savetext "command:i .txt
>> make i :i+1 ct ]; south
>>
>> Butit didn't work the program doesn't recognize the command
>> any suggestions?
>>
>
>
> Yes. As I said, use the WORD command.
>
>
> So, to create different filename words, you just have to know the command
>> to create words. That command is called "word"
>>
>
> make "counter :counter + 1
> show word "file :counter
>
> In your case it should be:
>
> savetext (word "command :i ".txt)
> make "i :i + 1
>
> Never forget to add spaces before and after math signs.
>
>
> You will also need to initialize the "i" variable with the command:
>
> make "i 0
>
>
>
> Also, remember that the MAKE command expects a word as the name of the
> variable; therefore, the name of the variable I needs start with that double
> quote character.
>
>
>
> Also, here:
>
> savetext (word "command :i ".txt)
>
>
> "command
> and
> ".txt
> are words too (not commands); therefore, they need to begin with the double
> quote character.
>
>
>
> Daniel
> OpenWorld Learning
>
>

  • Previous by thread: Re: MIA, Ask an Expert: write to a file
  • Next by thread: Re: MIA, Ask an Expert: write to a file

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008