Search found 76 matches

by physics-matt
28 Nov 2010, 20:49
Forum: Mindstorms Software
Topic: Help with "Text Contains"
Replies: 12
Views: 7969

Re: Help with "Text Contains"

Be sure to read the documentation on strcmp carefully. People often get it wrong first time because it doesn't quite work as they expect ;)
by physics-matt
27 Nov 2010, 09:35
Forum: Open Discussion
Topic: Need tutorials
Replies: 12
Views: 9712

Re: Need tutorials

Ah, sorry, I thought that the version you posted already included the "shortened" map. I think it would be really useful if you could come up with a couple of really simple examples of code that show when it works and when it doesn't - I also suggest splitting the Read and Write code into separate p...
by physics-matt
26 Nov 2010, 22:35
Forum: Open Discussion
Topic: Need tutorials
Replies: 12
Views: 9712

Re: Need tutorials

Are you sure that it works fine?

When I run it the second time (having previously run it and pressed the left button) and press the right button it prints 0 to the screen, indicating that A1 is length 0, so no data was read from the file.

Matt
by physics-matt
26 Nov 2010, 20:59
Forum: Mindstorms Software
Topic: Help with "Text Contains"
Replies: 12
Views: 7969

Re: Help with "Text Contains"

No problem. If you do have to modify the code for it to work, be sure to post a copy here.

At any rate, I'm sure you will learn a lot by going through it.

Matt
by physics-matt
26 Nov 2010, 19:56
Forum: Mindstorms Software
Topic: NXC File commands
Replies: 8
Views: 6619

Re: NXC File commands

Have you looked at the documentation? http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/index.html Also, have a look at the guide http://www.hsu-hh.de/download-1.4.1.php?brick_id=ADRUOaXwQ3q7fePG section 3.8, "Loader Module". There's also been a discussion on this sort of thing in another thread: htt...
by physics-matt
26 Nov 2010, 19:44
Forum: Mindstorms Software
Topic: Help with "Text Contains"
Replies: 12
Views: 7969

Re: Help with "Text Contains"

There doesn't appear to be a built in function, but this will probably work: bool IsIncluded( string s1, string s2 ) { bool included = false; for (int i = 0; i < (StrLen(s2)-StrLen(s1)) && !included; i++) { included = ( strcmp( s1, SubStr( s2, i, StrLen(s1) ) ) == 0 ); } return included; } I've not ...
by physics-matt
26 Nov 2010, 18:26
Forum: Open Discussion
Topic: Need tutorials
Replies: 12
Views: 9712

Re: Need tutorials

The compiled code for Read(fid2, A); is: mov __FReadArgs.FileHandle, __main_7qG2_fid2_7qG2_000 set __FReadArgs.Length, 6 syscall 3, __FReadArgs mov __D0main, __FReadArgs.Result unflatten A, __FReadTmpByte, __FReadArgs.Buffer, A The bit to notice is that __FReadArgs.Length has been set to 6, meaning ...
by physics-matt
26 Nov 2010, 09:00
Forum: Open Discussion
Topic: Need tutorials
Replies: 12
Views: 9712

Re: Need tutorials

I've had a look at your code in the other thread, and I gather that the line in question is Write(handle,Game); I've looked through the documentation again, and it turns out I was wrong about whether or not you can write structs directly to a file. For instance, the following code works fine: struct...
by physics-matt
25 Nov 2010, 08:16
Forum: Open Discussion
Topic: Need tutorials
Replies: 12
Views: 9712

Re: Need tutorials

There are two things you need to learn: first, how to format the data in your struct, and second, how to write the data to a file. There is no such command as "write this struct to a file" (EDIT: Yes there is, see below... oops :oops: ). Instead, you must turn the data in your struct into a string o...
by physics-matt
25 Nov 2010, 07:56
Forum: Mindstorms Projects
Topic: Heli Shooter
Replies: 9
Views: 7057

Re: Heli Shooter

I was thinking of rigging the heli with something bright, but I guess it just feels wrong to do so... I mean, a helicopter infiltrating into your airspace is unlikely to have convenient bright dots on it. I've also thought about getting another RC heli that is bright red, but again, just doesn't fee...