I'm not sure exactly what was causing the crash (something with the exit in the while loop?) but I re-wrote some of the code and came up with this:



Code:

local keyDirectPoll = zmg.keyDirectPoll
local keyDirect = zmg.keyDirect
local drawText = zmg.drawText
local fastCopy = zmg.fastCopy
local var_exit = 0

local key = {Exit=47, Left=38, Right=27}
local text = {x=300, y=1, string="test"}

while var_exit ~= 1 do

    if keyDirect(key.Exit) > 0 then var_exit = 1
       elseif keyDirect(key.Left) > 0 then text.x = text.x - 1
       elseif keyDirect(key.Right) > 0 then text.x = text.x + 1
    end
   
    drawText(text.x, text.y, text.string, 0x0000, 0xFFFF)
    fastCopy()
   
   keyDirectPoll()
   keyDirectPoll()

end


It seems to work as you intended the other code to.
OK, just thinking about the end-user here. How about making F6 open the shell prompt, and have the file manager as default?
flyingfisch wrote:
OK, just thinking about the end-user here. How about making F6 open the shell prompt, and have the file manager as default?


I support this suggestion.
Also, just to sum up the features i suggested on the IRC:

- drawCircledFill() function
- a function for screen capture

EDIT:

looked around, found some more:

Important:
- IO libs (i dont think i need to comment on that though)
- string libs
- Either give the file manager the ability to rename files or allow luazm to run txt files so that lua progs can be written on-calc

Not so important:
- make it possible to run a program but not discard global vars after execution... this could be used to make shared libs
- allow large font as well as small font

I think thats all, will edit if i remember anything else.
Hey, will it be possible to have commands for communicating through the 3-pin COMM port?
flyingfisch wrote:
Hey, will it be possible to have commands for communicating through the 3-pin COMM port?
Yes, the IO library will expose serial_write and serial_read calls of some sort.
Will there ever be a way to select Lua files through a list like TI-BASIC programs or like how on the Nspire you select Doom WAD files through a list, rather than having to manually type the run command and file name in? If that is already available, then I couldn't find it because no readme is available with LuaZM and the wiki only shows the syntax for the run command to launch Lua games, not the controls. I could not find any tutorial anywhere written specifically for LuaZM.

It took me about 10 minutes just to type run("bloxorz.lua"), depleting what I had left of batteries in the process, and could never get the game to launch at all (got Unknown Error Code). I also could never figure out how to re-enable uppercase or Alpha-lock after disabling it. Pressing 2nd/Alpha didn't do it. Also for some reasons, the MENU/Exit keys are barely responsive at all when trying to exit. I didn't notice which one actually worked because I just kept mashing them or holding them down one at once until it worked. At first I thought I had to type in a Quit/Exit command or something, which I tried in vain, so I went close to just pull a battery.
You must be using a very, very old version; LuaZM v0.1 and higher have a file browser, and v0.2 will have an even better and more stable on. I am waiting for Juju to incorporate my suggested case-change changes into PrizmIO for the typing problems.
Oh I downloaded it from the link in the Cemetech news and the archives. That was the only one I could find in the PRIZM section.
I hope this is a right place for bug report.
("ludr"):upper() returns "+4#1" instead of "LUDR" and
("ludr"):lower() retruns something that looks like 4 spaces.
That would seem to be a problem with the PrizmSDK rather than LuaZM itself, as I call the toupper() and tolower() functions from the SDK. I have my own versions of both that I can uncomment if the "official" PrizmSDK 0.4, coming soon, doesn't fix the issue.
I believe copySpriteMask is broken. It skips transparent color in horizontal direction instead of not printing it.
Here is code, same sprite with and without mask. mask in this case is an ugly pink. You might need the magnifying glass to see what is going on, but even without magnifying glass it the distortion is visible.

Code:

 WHITE=zmg.makeColor(255,255,255) 
 GREY=zmg.makeColor(128,128,128) 
 BLACK=zmg.makeColor(0,0,0) 
 EDIT=zmg.makeColor(251,210,128) 
 MASK=zmg.makeColor(255,0,255) 
 SCREENX,SCREENY=384,216 
 
tiles={ -- {{{ 
w=17, 
h=17, 
dx=16, 
dy=12, 
 
[0]= 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81F000000000000000000000000000000000000000000000000000000000000F81F\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
F81F000000000000000000000000000000000000000000000000000000000000F81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81F000000000000000000000000000000000000000000000000000000000000F81F\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
0000000000000000000000000000FF80FF80FF800000000000000000000000000000\z
000000000000000000000000FF80FF80FF80FF80FF80000000000000000000000000\z
000000000000000000000000FF80FF80FF80FF80FF80000000000000000000000000\z
000000000000000000000000FF80FF80FF80FF80FF80000000000000000000000000\z
0000000000000000000000000000FF80FF80FF800000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
00000000000000000000000000000000000000000000000000000000000000000000\z
F81F000000000000000000000000000000000000000000000000000000000000F81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81F00000000000000000000FBE4FBE4FBE4FBE4FBE400000000000000000000F81F\z
00000000000000000000FBE4FE41FE41FE41FE41FE41FBE400000000000000000000\z
0000000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FBE40000000000000000\z
000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FE41FE41FBE4000000000000\z
000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FE41FE41FBE4000000000000\z
000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FE41FE41FBE4000000000000\z
000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FE41FE41FBE4000000000000\z
000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FE41FE41FBE4000000000000\z
0000000000000000FBE4FE41FE41FE41FE41FE41FE41FE41FBE40000000000000000\z
00000000000000000000FBE4FE41FE41FE41FE41FE41FBE400000000000000000000\z
F81F00000000000000000000FBE4FBE4FBE4FBE4FBE400000000000000000000F81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81F00000000000000000000FBE4FBE4FBE4FBE4FBE400000000000000000000F81F\z
00000000000000000000FBE488028802880288028802FBE400000000000000000000\z
0000000000000000FBE48802880288028802880288028802FBE40000000000000000\z
000000000000FBE4880288028802880288028802880288028802FBE4000000000000\z
000000000000FBE4880288028802880288028802880288028802FBE4000000000000\z
000000000000FBE4880288028802880288028802880288028802FBE4000000000000\z
000000000000FBE4880288028802880288028802880288028802FBE4000000000000\z
000000000000FBE4880288028802880288028802880288028802FBE4000000000000\z
0000000000000000FBE48802880288028802880288028802FBE40000000000000000\z
00000000000000000000FBE488028802880288028802FBE400000000000000000000\z
F81F00000000000000000000FBE4FBE4FBE4FBE4FBE400000000000000000000F81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F000000007BEF00000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F000000000000B2C0B2C07BEF7BEFB2C0000000000000F81FF81FF81F\z
F81F00000000B2C0B2C0B2C0B2C0B2C07BEF7BEFB2C0B2C0B2C0B2C000000000F81F\z
00007BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF0000\z
0000B2C07BEF7BEFB2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C00000\z
0000B2C07BEF7BEFB2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C00000\z
0000B2C07BEF7BEFB2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C00000\z
0000B2C07BEF7BEFB2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C0B2C00000\z
00007BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF7BEF0000\z
0000B2C0B2C0B2C0B2C0B2C0B2C0B2C07BEF7BEFB2C0B2C0B2C0B2C0B2C0B2C00000\z
F81F00000000B2C0B2C0B2C0B2C0B2C07BEF7BEFB2C0B2C0B2C0B2C000000000F81F\z
F81FF81FF81F000000000000B2C0B2C07BEF7BEFB2C0000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F000000007BEF00000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F0000000000000000FD79FD79FD790000000000000000F81FF81FF81F\z
F81F00000000000000000000FD79E8E4FD79E8E4FD7900000000000000000000F81F\z
000000000000000000000000FD79FD79FD79FD79FD79000000000000000000000000\z
000000000000000000000000FD79FD79FD79FD79FD79000000000000000000000000\z
0000000000000000000000000000FD79FD79FD790000000000000000000000000000\z
00000000000000000000000000000000FD7900000000000000000000000000000000\z
00000000000000000000FD79FD79FD79FD79FD79FD79FD7900000000000000000000\z
000000000000FD79FD79FD79FD79FD79FD79FD79FD79FD79FD79FD79000000000000\z
000000000000FD79FD7900000000FD79FD79FD7900000000FD79FD79000000000000\z
000000000000000000000000FD79FD79FD79FD79FD79000000000000000000000000\z
000000000000000000000000FD79FD790000FD79FD79000000000000000000000000\z
F81F0000000000000000FD79FD79FD790000FD79FD79FD790000000000000000F81F\z
F81FF81FF81F00000000000000000000000000000000000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F00000000000000000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
", 
 
"F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81F000000007BEF00000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81F0000000000007BEFFD79FD797BEF7BEF000000000000F81FF81FF81F\z
F81F000000007BEF7BEF7BEFFD79FD79E8E4FD797BEF7BEF7BEF7BEF00000000F81F\z
00007BEF7BEF7BEF7BEF7BEFFD79FD79FD79FD79FD797BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEF7BEF7BEFFD79FD79FD797BEF7BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEF7BEF7BEFFD79FD797BEF7BEF7BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEF7BEFFD79FD79FD79FD79FD797BEF7BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEF7BEFFD79FD79FD79FD79FD79FD79FD79FD79FD797BEF7BEF0000\z
00007BEF7BEF7BEFFD79FD79FD79FD797BEF7BEF7BEF7BEF7BEFFD79FD797BEF0000\z
00007BEF7BEF7BEFFD79FD79FD79FD797BEFFD79FD79FD797BEF7BEF7BEF7BEF0000\z
00007BEF7BEF7BEFFD79FD79FD79FD79FD79FD79FD79FD79FD797BEF7BEF7BEF0000\z
00007BEF7BEF7BEFFD79FD79FD79FD79FD79FD797BEFFD79FD79FD797BEF7BEF0000\z
F81F000000007BEF7BEF7BEFFD79FD79FD797BEF7BEF7BEFFD79FD7900000000F81F\z
F81FF81FF81F0000000000007BEF7BEF7BEF7BEF7BEF000000000000F81FF81FF81F\z
F81FF81FF81FF81FF81FF81F000000007BEF00000000F81FF81FF81FF81FF81FF81F\z
F81FF81FF81FF81FF81FF81FF81FF81F0000F81FF81FF81FF81FF81FF81FF81FF81F", 
 
} -- }}} 
 
 function drawTile(x,y,n,mask) 
   if nil~=mask then 
     zmg.copySpriteMask(x, y, tiles.w, tiles.h, mask, tiles[n]) 
   else 
     zmg.copySprite(x, y, tiles.w, tiles.h, tiles[n]) 
   end 
 end 
 
 zmg.drawRectFill(0,0,SCREENX,SCREENY,BLACK) 
 clr={WHITE,GREY,EDIT} 
 c=1 
 for y=0,SCREENY-1,3 do 
   zmg.drawLine(0,y,SCREENX-1,y,clr[c]) 
   c=(c%#clr)+1 
 end 
 for x=0,SCREENX-1,3 do 
   zmg.drawLine(x,0,x,SCREENY-1,clr[c]) 
   c=(c%#clr)+1 
 end 
 
 for i=1,#tiles do 
   drawTile(20,i*20,i,MASK) 
   drawTile(40,i*20,i) 
 end 
 
 zmg.fastCopy() 
 zmg.keyMenu() 
 
 
 


nsg, yes, I reported that bug earlier, but I can't find where...

Kerm: hurry up and release the new version please! Very Happy
flyingfisch wrote:
nsg, yes, I reported that bug earlier, but I can't find where...

Kerm: hurry up and release the new version please! Very Happy
In fact, I think I may have fixed it in my local copy already. Smile I'll do my best to publish the new version as soon as I have time. Sad
Also, if filebrowser is already in the code to process F6, could you also add it to zmg?

Like


Code:

fielpath=zmg.fileBrowser("*.slc")
if nil~=filepath then .....


Of course it makes sense only when io is functional.
nsg wrote:
Also, if filebrowser is already in the code to process F6, could you also add it to zmg?

Like


Code:

fielpath=zmg.fileBrowser("*.slc")
if nil~=filepath then .....


Of course it makes sense only when io is functional.


I think run() already does that. Wink
It sounds to me as if he wants to pop up a filebrowser so that the user can pick a file. I guess there's no great reason why that couldn't be done...
So, for now, instead of using copySpriteMasked(since it is messed up), I just use copySprite?

Also, you should have a zmg.copySpriteAlpha function. Twould be nice.
KermM, yes that's what i meant: file browser to use by lua programs.
BTW, would you care posting the next Beta with whatever fixes it has now? I could really use those transparent sprites. ANd it could use some testing.
I need to finish incorporating gbl08ma's new file browser to get it to compile first, but as soon as I do I shall release it. Please continue reminding me.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6  Next
» View previous topic :: View next topic  
Page 4 of 6
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement