Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 20:49:10 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 2 3 [4] 5 6 ... 10   Go Down
  Print  
Author Topic: General Ndless Questions and Support -  (Read 10182 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:47:54
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2172


Total Post Ratings: +122

View Profile
« Reply #45 on: 21 April, 2012, 17:54:36 »
0

What are the screen dimensions?

How do I display integers (with nRGBlib)?

Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Today at 13:07:49
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 766

Total Post Ratings: +151

View Profile
« Reply #46 on: 21 April, 2012, 19:22:51 »
0

The screen is 240x320.

Use something like this to convert it to a string:
char buf[20];
sprintf(buf, "%i", thenumber);

Then display the string with nRGBlib.
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 20:47:44
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 844


Total Post Ratings: +148

View Profile WWW
« Reply #47 on: 21 April, 2012, 19:50:18 »
0

A smarter way to debug values on the handled is to user sprintf and show_msgbox =)
« Last Edit: 21 April, 2012, 19:50:41 by Levak » Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:47:54
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2172


Total Post Ratings: +122

View Profile
« Reply #48 on: 21 April, 2012, 22:54:54 »
0

The screen is 240x320.

Use something like this to convert it to a string:
char buf[20];
sprintf(buf, "%i", thenumber);

Then display the string with nRGBlib.
So the string is called buf in this example?

Also, is there a way to save high scores?
Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 20:47:44
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 844


Total Post Ratings: +148

View Profile WWW
« Reply #49 on: 22 April, 2012, 00:24:07 »
0

Also, is there a way to save high scores?

Writting in a file ?


1
2
3
4
5
6
7
FILE * f = fopen("/documents/mygame_highscore.tns", "w+");
char buf[integerSize(highscore) + 2];
sprintf(buf, "%d", highscore);
fputs(buf, f);
fclose(f);
refresh_osscr(); // refresh OS screen so that we can see the created file when we exit the program


1
2
3
4
5
6
int integerSize(int n) {
  int i;
  for(i = 0; n > 0; n/= 10, i++);
  return n
}
« Last Edit: 22 April, 2012, 00:28:37 by Levak » Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Today at 13:07:49
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 766

Total Post Ratings: +151

View Profile
« Reply #50 on: 22 April, 2012, 08:52:07 »
0

You can also use fwrite or fprintf for this (666th post!)
« Last Edit: 22 April, 2012, 08:52:35 by ExtendeD » Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 18:03:22
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50237


Total Post Ratings: +2615

View Profile WWW
« Reply #51 on: 22 April, 2012, 15:22:42 »
0

I wonder... is self-modifying code possible in Ndless, as in highscores storing themselves inside their respective games rather than external files? I saw that happen often on the TI-83 Plus in the past.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 19:28:54
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #52 on: 22 April, 2012, 15:25:45 »
0

I suppose so, but it isn't the most easy thing to do. Maybe someone can make a lib for it Smiley
Logged

DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 18:03:22
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50237


Total Post Ratings: +2615

View Profile WWW
« Reply #53 on: 22 April, 2012, 15:28:53 »
0

Actually I do not remember what was the main use on the TI-83 Plus since external data was often in appvar form anyway and did not take any space in the PRGM/apps menu, but on the TI-Nspire I notice that external files often clutter the TI-Nspire document explorer, and I remember people ranting about having too many files on the TI-83 Plus before, which tells me some TI-Nspire users might not like it very much to see their menu cluttered. It is particularly bad when you got 50 gbc4nspire ROMs with savestates. Of course there are folders, though.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:47:54
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2172


Total Post Ratings: +122

View Profile
« Reply #54 on: 22 April, 2012, 15:31:51 »
0

I suppose so, but it isn't the most easy thing to do. Maybe someone can make a lib for it Smiley
That would be nice.
* epic7 thinks he'll skip high scores for now
Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 20:47:44
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 844


Total Post Ratings: +148

View Profile WWW
« Reply #55 on: 22 April, 2012, 15:52:49 »
0

I wonder... is self-modifying code possible in Ndless, as in highscores storing themselves inside their respective games rather than external files? I saw that happen often on the TI-83 Plus in the past.

You can, but if the file size get modified, like if you recompile with extra stuff / updates, the highscore system will crash.
Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 18:03:22
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50237


Total Post Ratings: +2615

View Profile WWW
« Reply #56 on: 22 April, 2012, 15:55:44 »
0

Ok thanks for the info. Smiley

Also any executable code size limit or file size limit? On 68K calcs, I think it was 64 KB for both and on the 83+, a file cannot be larger than 65535 KB in archive and as large as the RAM allows in RAM, but the code limit on the 83+ for regular program files was 8.1 KB or 8.8 KB depending of where you ran it.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 19:28:54
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #57 on: 22 April, 2012, 15:59:25 »
0

Levak, if you store the data on the end of the tns file, and you can get the size of it using Ndless there should not be any problem.
Logged

Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 20:47:44
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 844


Total Post Ratings: +148

View Profile WWW
« Reply #58 on: 22 April, 2012, 20:23:11 »
0

Levak, if you store the data on the end of the tns file, and you can get the size of it using Ndless there should not be any problem.
But you will lose highscore on each modification, it was a part of what I meant.
Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #59 on: 14 May, 2012, 15:06:32 »
0

The fgets function seems to have a glitch:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
char *fgets(char *str, int num, FILE *str2eam) {
char *str2 = str;
while (num--) {
char c = fgetc(str2eam); //THIS IS THE BUGGY LINE
if (c == EOF) {
*str2 = '\0';
return NULL;
}
*str2++ = c;
if (c == '\n')
break;
}
*str2 = '\0';
return str;
}

The c variable should be specified as an int, not a char -- it looks like the compiler treated the char as unsigned and optimized out the return NULL entirely! Plus, it is possible that an 0xFF character exists in the file, so signed char is not the way to go.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Pages: 1 2 3 [4] 5 6 ... 10   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.262 seconds with 32 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.