(nspire_emu with extra features, I recommend it)Its closed-source nature is not a good thing for the community, though.
Quote(nspire_emu with extra features, I recommend it)Its closed-source nature is not a good thing for the community, though.
@Jonius7: nspire
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/
2.) I haven't made an update yet, because I don't get the emulator to work :/ But those button rebinds are already in the current version.
3.) BIG thanks for that reference to nSpaint!!! :D Now I don't have to do that; Chockosta wrote ~2200 lines of code for that! I'll ask him for permission for integration or I'll just put a note somewhere...
1.) Thanks for your the hint for the emulator, but I don't get it to work: everytime I try to start "nspire_emu.exe" a black window flashes once and nothing else happenes :/https://tiplanet.org/forum/viewtopic.php?f=57&t=8698
Yes, I only used the gtk to extract boot2.img to boot2.raw but apparently that doesn't work anymore with 3.xYou can also use polydumper (https://tiplanet.org/forum/archives_voir.php?id=3829) in order to dump the boot2.raw from the calc.
The recommended tool of TI-Planet "imgmanip" I can't use because I don't know how to C++ :-\
Sorry, but I'm busy next 2 days... I'll do another try with the emulators then. I don't know why anyone would give a -1 to those posts so I gave +1 to make that up.some people here despise the fact that KarmTI is closed source so much that they rate down every post that says anything positive about the emulator. I think staff threatened a ban before on such abuse of the rating system, but nothing has been done yet I think because due to the way ratings are stored in the database, it is impossible to know *when exactly* somebody in particular rated a certain post. It is possible that admins are just unaware of any suspicious activity, though, so I would suggest that you report the post then write in the reason that there might be rating abuse. Of course it could totally be a mistake as well (accidentally clicking the wrong icon).
the fact is that most of this topic's posts which contain positive things about that emulator have not been downrated.The reason why they're not downrated is because somebody uprated them after someone downrated them. AFAIK, though, only 1 post was downrated, so it might have been a misclick.
Downrating is normally the only allowed way to express oneself about the emulator and its badness for a community, since the matter is in moderation territory...
only 1 post was downrated, so it might have been a misclick.... so you're still thinking that downgrading posts, where there are positive arguments about that emulator, is a mistake/misclick ? even after what Lionel said ?
@imath: I think there are many ways to interprete that question (or my english is not good enough...):
- The number of lines of a code doesn't impact the performance because the code is saved in the RAM as a table with one line per index and only the visible lines get rendered.
- The number of visible characters on the screen does impact the performance because rendering a string/char is relatively slow.
- The number of characters in a visible line does impact the performance because every character of the visible lines does impact the syntax colouring and have to be processed.
- Moving around in large codes is also easy with the clickable scrollbar on the right.(Have anyone notice it yet?!) But i think I'll add a "jump to line..."option.
@mdr1:
- I'm working on copy/pasfe functions (just finished paste function)
Thanks to everybody for the nice feedback! I think the editor is finished soon! :D
@AnToX98: Wow, thanks and congrats to you! My french is very poor but I undestood the most, really nice review! Maybe I'll add french translations for the great french community!
PS: Just noticed that "Skript" is actually german... I meant "Script"... Now I can replace that dang letter everywhere! :banghead:
@jwalker: I think this is not possible as long as TI blocked all functions to use the file system. Also user-defined libraries are not supported.It is, you place a document with public variables in the library portion of the Nspire and then call using the Lua var functions. You would just have to write a standard for how code can be imported, and boom you have library like functionality.
@jwalker: Wow, didn't know that! I'll do some research about that. Is that function available in apilevel 1 and 2? That would be a nice option to kinda use the file system! :DHere is an example : http://ourl.ca/10565/242834
- To make a library with sourcecode entirely loadable the whole code has to be saved as a string and saved in a variable? And then use var.recall("file//var") to get the code as string?Yep
- What happenes if the string is too large to load?IIRC the limit is something like 65535 (or another lower multiple of 2) characters.
- How to check and delete those variables?Usually, in a math page, to see them : press the var button, or Ctrl-L. To delete them : just do a bunch of "Delvar xxxx". But seeing the amount of variables you have here, you should just create a new .tns and copy/paste the lua page onto the new one, so there won't be a single basic variable anymore (until your scripts makes some)
- Yeah, I thought about mouse-based selection but then I thought: "Why would anyone use the ported Script Editor when he could just use the original one on the PC?!"Well, then it'd work on the iPad too, for example :)
- Same as above
- The problem here is that when I reduce the space between the letters even one pixel, Upper-case characters like "W" or "G" or "M" would overlap each other and the code wouldn't be readable anymore...Ok
About the "S": I just forgot to call __mG.initialChrOff() after changing the font, I'll fix that ;)
- I've set apilevel='1.0' for compatibility reasons, the new withGC doesn't work here (?)... But maybe I'll make a 3.2 Version of the Editor some day...If you "compile" your lua code with Luna and don't set an apilevel, then the script will work under all 3.x OSes. Then it's yoru job to detect what features are available. For example, detecting if we are on 3.2 (apilevel "2.0") is easy : if platform.withGC then .... end or : if platform.registerErrorHandler ....
- I like the Idea an autocompletion, but that is huge function and I think I actually used EVERY user-caused event :PWell, still, it'd be uber cool (and it's not even done correctly (pretty much the same as if there were none) in the computer software !)
PS: I know the code is far from perfect, I am still new to lua (and even to programming in general) and I'm still far from knowing all opportunities of lua. You may like posting some improvement proposal on the code. Thanks for the feedback! :)It's pretty good core already, especially if you're new to Lua ;)
Edit : also, what about apilevel 2 documention ? (without the physics stuff, though)I made the content when I didn't know that apilevel 2 functions can be available in apilevel 1 and now I forgot to add them... Update tomorrow :P
if platform.isTabletModeRendering then
if touch then -- maybe even : if touch and touch.enabled() then
if not touch.isKeyboardVisible() then
touch.showKeyboard()
end
end
end
- At the moment the contend is save like this: content["Graphics"]["drawString"]=... and the menu is created via pairs(content) and the pairs function doesn't sort in any way... I'look what I can do here.Well, in the output script, reordering the things by hand would work ^^
- Ah, didn't know that I have to trigger the keyboard, that'll defenitely be in the update tomorrowHere's a version with the keyboard working in the iPad : http://pastebin.com/x49Xmsis
- About the button, I found that picture on the TI website:Yes there is. I guess it can work, I haven't tested. However, the thing is : How do I access the keyboard on the iPad, while in the user's script ? ;)
(http://education.ti.com/en/us/~/media/Images/TI%20Education/US/iPad%20App/product-ipad-proper-math-notations.png)
There is a EE button on the right, doesn't that work?
- I'm still a bit confused about setting the api level: What do I have to do that the editor runs on older OS (3.0-3.1) but also executes newer functions?- Don't put any platform.apilevel at the top of the script source
When you paste, you are waiting for an event like a click to occur, what about just showing the pasted text as soon as it's done ? ;)Yeah, I'll fix that
Edit 5 : You should put copy/paste in an "Edit" toolpalette.Ok, I'll do that
Well, in the output script, reordering the things by hand would work ^^Yeah, but... work :( ok, I'll do it
Yes there is. I guess it can work, I haven't tested. However, the thing is : How do I access the keyboard on the iPad, while in the user's script ? ;)Maybe I'll just leave the Keyboard up and when the event on.keyboardDown() is fired, it'll automatically return to the editor because <epic> the last chance of return was destroyed </nonsense>
Maybe you'll have to force a toolpalette with a "Back to Editor" function, or force the "EE" key (backing up the user's on.charIn, handle the EE button, then let the user's charIn resume/continue.)
- Don't put any platform.apilevel at the top of the script sourceOk, I'll see what I can do here...
- make a bunch of tests for the functions that are new in 3.2 and 3.4. (the if you made, that's good. However you dont need if on.resize, that exists on all versions. ; whatch out with on.create/on.construction. in on.construction all the API isn't ready yet. if you need some API things in it, reconsider this by making init codes within on.resize for example)
- compile the .lua file with Luna to get a .tns working with any 3.x OS.
- make any change to the .tns with a 3.1 software if needed (here, adding the tab 1.2...) .
- Save under OS/software 3.1
Edit : watch out for the screen size available when the keyboard is up, on the iPad. There are some functions that will help you here : http://wiki.inspired-lua.org/Changes_in_OS_3.4 (platform.window:getScrollHeight() etc.)
function __mG.on.mouseUp()
__mG.mouseDown=nil
if platform.isTabletModeRendering and platform.isTabletModeRendering() then -- 3.4 detection
-- toolpalette bug workaround
platform.window:setFocus(false)
platform.window:setFocus(true)
if touch then
if not touch.isKeyboardVisible() then
touch.showKeyboard()
end
end
end
end
textBox=D2Editor.newRichText()
...
if textBox.setFontSize then
textBox:setFontSize(size)
end
Is this right? I'm a bit confused because of ./:
I think the program is finished, does everything work now? If so, then I'll compile it with Luna and then upload to ticalc.org.Well, as long as it runs on 3.1 :)
Edit: Would there be problems if I'd just leave out setting the apilevel and don't compile with Luna? I tested it with apilevel='1.0' and '2.0'
Well, I guess not (I noticed that running a program made in OS 3.2 wont work on nspires with OS 3.0/3.1 without setting the apilevel to 1.0) but where do I get a 3.1 software to add page 1.2?
And another question: I used "if touch and touch.isKeyboardAvailable then" somewhere; is that right or is "touch.isKeyboardAvailable" a function?It's actually a function, but since Only the tablets' OS have it implemented... it works the same way. For forward compatibility, try calling the function, though, instead.
I don't get luna to work, I guess it's because I installed everything on my HDD while my SSD is my system drive. I'll just include two versions then:
- "apilevel1 OS 3.x" with "platform.apilevel='1.0'"
- "apilevel2+ OS 3.2+" without an apilevel setting
If I get it to work some day or find another way I'll update the file.
6 weeks holiday + Jens + Music = great programming progress :D
And as I said earlier to AnToX98:Yeah I wish I could do that, I probably could, but I get lazy and instead play too much games during my breaks.6 weeks holiday + Jens + Music = great programming progress :D
I use Linux, so that's not a solution for me.I use linux too and wine is my friend. I can even reinstall multiple trials by completly unintalling wine.
PS: I have a completely unrelated idea: How about an "empy tns file" where you can paste your code and then it will forever execute the pasted code?That's what oclua does (or at least the version I still have around) you write your script in a notepad or another thing, then copy/paste it in the lua script and it will execute your code.
require "color"
function on.paint(gc)
gc:setColorRGB(color.red)
gc:drawString("Red",10,30)
end
and it worked. That proves that loading libraries works!
platform.apilevel = "2.0"
require "physics"
timer.start(0.01)
function on.resize()
W = platform.window:width()
H = platform.window:height()
space = physics.Space()
newBody = physics.Body(100, 0)
newBody:setVel(physics.Vect(1000,1000))
space:addBody(newBody)
end
function on.paint(gc)
local width = W/10
local pos = newBody:pos()
local vel = newBody:vel()
local velX = vel:x()
local velY = vel:y()
local posX = pos:x()
local posY = pos:y()
if posX > W then
velX = -1 * math.abs(velX)
posX = W
elseif posX < 0 then
velX = math.abs(velX)
posX = 0
end
if posY > H then
velY = -1 * math.abs(velY)
posY = H
elseif posY < 0 then
velY = math.abs(velY)
posY = 0
end
newBody:setPos( physics.Vect(posX, posY) )
newBody:setVel( physics.Vect(velX, velY) )
gc:setColorRGB(0, 0, 255)
gc:fillArc(posX, posY, width, width, 0, 360)
end
function on.timer()
space:step(0.01)
platform.window:invalidate()
end
is the a way to remove or hide the 2D Editors in apilevel 1?No, and this is why it exists in apilevel 2. In apilevel 1, D2Editors were unusable.
PS: How do you name development versions between v1.0 and v2.0?
Also, you should wonder if you want to support old apilevel (since 3.6 is ndlessed, not a whole lot of people will be/stay on OS 3.1 forever...).Yes, you are right! Covering all possible situations for an error is far more complicated that just register and errorHandler... but now I already covered the most anyways ^^
On some cases, it will be simpler to just use new apis rather than testing if it's available then use it, (in addition to having to code fallbacks (when possible) for older versions.)
Reducing functions would be very nice to as I mentioned it but I know it's hard to do it :)Yes, very hard indeed... I currently have no idea how to realize that with the current "engine"... But it wouldn't be the first time if I found an unexpected solution in the middle of a boring history lesson ;)
Could you give anyways the new file ?Um... lets say tomorrow (trust me, you wouldn't have much fun with the current mess of the front-end! ;))
Another question : how about compatibility with the "Ressources" images on os 3.6 ? And customize the colours ?I still use the old 3.2 software (sorry), because I couldn't find much informations about 3.6; neither about the lua api, nor the 3.6 script editor. Does it still have an option to convert an image to the old format?
Why I can't open MENU :D ?Probably because you focus the console application, that happened to me too a few times ;) Just click on the editor so that it's rim is black instead of grey
No I'm 100% on the editor and I can't open menu :(Hm.. I couldn't recreate the problem, probably because you have 3.6 and I have 3.2... Thanks for the report, I'll fix it!
EDIT : I deleted "platform.apilevel = 1.0" and replaced create by on.construction and it works :D
It doesn't work on 3.1. :(Yes, this prerelease works only on OS>=3.2! I didn't think anybody still uses OS 3.1. Is there a special reason that you still use it? Because I'm not sure if I should still support OS3.1
Yes, this prerelease works only on OS>=3.2! I didn't think anybody still uses OS 3.1. Is there a special reason that you still use it? Because I'm not sure if I should still support OS3.1Well, I'm not alone to remain on OS 3.1 because since the 3.2, many many bugs and display issues appeared.
3.1! Great! I found a bug: when I launch the script and I modify it by removing a character, the application makes an error:Oh, yes, thank you for the report! I forgot some handlers for the new dialogue... Just don't try to modify your code while the script is running for now ::)
991: attempt to index field '?' (a nil value)
LDStudios: Those libraries are in the guide in the editor.LDStudios ment the standard libraries explained here: http://www.lua.org/manual/5.0/manual.html#5.1 (http://www.lua.org/manual/5.0/manual.html#5.1). I now plan to make an addable library file that includes the extended guide data :)
Very nice :DNice! I like that updates still get translated to ti-planet for the french community! :)
(I summed it up on tiplanet (http://tiplanet.org/forum/viewtopic.php?p=167741#p167741), btw)
Also, it crashed (line 2327 : attempt to index field '?' a nil value) when I tried to copy a part of the code I selected.Thanks for the report, but I was not able to recreate the bug and I have no idea what could have caused it... But I made that part a bit safer to prevent a crash
Why don't you just enable the errorHandler, by the way, for "releases" ? :PYes, you're right, I'll do that ;)
(I don't recommend enabling it while writing/debugging, though ^^)
-Custom Libraries, with Adriweb's Better Lua API as a built in library. Also the ability to add other libraries of your own.Sorry, but I don't like the idea of a special environment. I want to keep the compatibility of the script as it is to any emulator. But you could pack the library into a library file and load it in your script! Another option would be, that I'll implement the option of setting a custom standard "Header" which is inserted in every new file you create. (Sorry, my english is bad today :P )
-Ability to click the X in the top right of the customize boxThis is both already possible; it's just nearly impossible to aim correctly with the "text" cursor. But, as you mentioned, I'll change to the default cursor for dialogues in future ;)
-Ability to mark check boxes with cursor as well as buttons
-The application that runs the script didn't work for me until I clicked on the page, after the first time it worked fineThat's probably because the console application was focused. That's not really a bug, because the execution of the script in the user script page is triggered by the "on.activate" event, which is only triggered if it's application is focused.
-Ability to save custom themesIndeed, it works fine on the emulator but doesn't on the handheld. The problem seems to be that var.recall apparently doesn't work in the first call of on.activate. I hate that TI doesn't mention such things in their guide and have such differences between emulator and handheld... :( I'll try to find an other suitable event for initialization that fits all needs then... :/
Also, how did you use ctrl+M to select the line?ctrl+M triggers the on.createMathBox event on OS>3.1
-Ability to save custom themesIndeed, it works fine on the emulator but doesn't on the handheld. The problem seems to be that var.recall apparently doesn't work in the first call of on.activate. I hate that TI doesn't mention such things in their guide and have such differences between emulator and handheld... :( I'll try to find an other suitable event for initialization that fits all needs then... :/
-Custom Libraries, with Adriweb's Better Lua API as a built in library. Also the ability to add other libraries of your own.Sorry, but I don't like the idea of a special environment. I want to keep the compatibility of the script as it is to any emulator. But you could pack the library into a library file and load it in your script! Another option would be, that I'll implement the option of setting a custom standard "Header" which is inserted in every new file you create. (Sorry, my english is bad today :P )
That makes sense, but you should at least be able to minimize the header so that you don't have to scroll through it.Yes, but work! I'll have to completely rewrite many functions to make it possible to collapse/expand parts of the code; that'll take some time. I'll first implement a faster method of scrolling (as you suggested months ago); I only have to find a event for that: I think I'm already using all available Buttons :/
Anyways, I probably won't be downloading JSE updates for a while, my calculator is broken and its useless on Student Software. I might be able to get a new one at the start of the school year but I'm not sure yet.That's bad news! I hope that won't keep you from developing!
- the autocomplete function will only find functions for gc if you have "gc" or "gc:". Any further character won't be seen as part of "gc:", so "gc:f" will result in autocomplete option "for" and "function"I think you don't have the newest version; I already fixed both ;)
- include the standard table library to the autocompleter (you could also search _G and its subtables for available functions and tables)
- When I tried to execute a script rebinding functions of the event handler using "setmetatable(on)" I encountered the problem that your execution page did this too and overwrote my event handlerYes, that part of the code had some mistakes; it was on my todo-list to rewrite it for a while... I'll fix it for the next alpha release!
- make the autocompleter recognize variables and user functionsThat'll be work too because the editor deosn't understand anything of the written code yet, it only colors it correctly. But soon holidays begin and I'll have more time to work then! :)
That makes sense, but you should at least be able to minimize the header so that you don't have to scroll through it.Yes, but work! I'll have to completely rewrite many functions to make it possible to collapse/expand parts of the code; that'll take some time. I'll first implement a faster method of scrolling (as you suggested months ago); I only have to find a event for that: I think I'm already using all available Buttons :/
Anyways, I probably won't be downloading JSE updates for a while, my calculator is broken and its useless on Student Software. I might be able to get a new one at the start of the school year but I'm not sure yet.That's bad news! I hope that won't keep you from developing!
Even in the newest version the table library is not included to autocomplete ;) The coroutine library is mising, too- the autocomplete function will only find functions for gc if you have "gc" or "gc:". Any further character won't be seen as part of "gc:", so "gc:f" will result in autocomplete option "for" and "function"I think you don't have the newest version; I already fixed both ;)
- include the standard table library to the autocompleter (you could also search _G and its subtables for available functions and tables)
- make the autocompleter recognize variables and user functionsThat'll be work too because the editor deosn't understand anything of the written code yet, it only colors it correctly. But soon holidays begin and I'll have more time to work then! :)
--[[
A commentary
on several lines.
]]
It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.The problem is that such a feature requires ndless and many people don't have ndless installed.
On JSE 2.0A3 3.1, the multi-lines commentaries don't work:It works, but the editor doesn't mark it correctly.Code: [Select]--[[
A commentary
on several lines.
]]
JSE 2.0A4 doesn't work on 3.1.What's the problem? Does it not open, does it crash or does the menu not work?
It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.I don't have ndless installed and I don't want to install it. But it's even possible with lua: A file where you can paste your code in and from then on it directly executes it everytime you open the file. It would handle exactly like a normal program with the given code. The only difference would be, that the file has a small script included, which loads the code from the memory.
EDIT: Special characters like "é", "è" and "à" don't work.Yes, I switched back from rendering unicode characters to only ascii characters because of performance issues. Although they look strange in the editor, lua still handles them correctly.
Which is basically not much different from oclua. It would only keep the code forever.It would be great to enable thanks to ndless to create a real Lua application with this program, like this editor is one.I don't have ndless installed and I don't want to install it. But it's even possible with lua: A file where you can paste your code in and from then on it directly executes it everytime you open the file. It would handle exactly like a normal program with the given code. The only difference would be, that the file has a small script included, which loads the code from the memory.
itched back from rendering unicode characters to only ascii characters because of performance issues. Although they look strange in the editor, lua still handles them correctly.
But that's not the "hard" part. The actual ndless hook (lua extension rather) that makes a proper .tns from a script is doable, I assume, but it would take a bit of work...Porting luna should do the job. The problem is that all libraries required to build luna have to be ported to ndless, too.
It works, but the editor doesn't mark it correctly.That's what I meant. :)
What's the problem? Does it not open, does it crash or does the menu not work?
Indeed, I had a problem registering my platform.withGC fallback function on apilevel="1.0", so I just disabled it and forgot to reenable it later, sorry!What's the problem? Does it not open, does it crash or does the menu not work?
It seems you added JSE 2.0A4 3.1 but neither does it works. When I try to open it, the OS says the device has to be updated to open it.
Why does the unicode involve such performance issues?Splitting a string in its characters and mind UTF-8 encoded unicode characters is a bit difficult. The Nspire API offers a special string.usub function for that, but it's slower than the normal string.sub function. Now after much optimizing, this wouldn't have a big impact anymore; I could switch it back, but there is another problem: Most functions of the string library doesn't have a unicode equivalent, so I have to use the normal ascii-only functions. Using unicode characters at rendering, but using ascii-functions for editing leads to confusion results: I had this setup for v1.0 and there you can see offset cursor positions other weird behaviours when using unicode characters.
function string.ulen(s) return select(2, s:gsub('[^\128-\193]', '')) end
The 'fixed' file when launched has the following error: "40: attempt to call global 'getTableAsStrings' (a nil value)".
@Adriweb: Thank you for keeping the ti-planet article updated; I would do it myself if I could speak french ;) . Oh and I noticed that you apparently mistakenly translated and pasted the post of the older beta 1 version...damn it that's why it looked familiar lol
Ok, it's now finally on ticalc.org (http://www.ticalc.org/archives/files/fileinfo/462/46209.html), although it seems like I was too late for POTY :/Shame its so late, this would completely deserve a POTY (IMO). I would recommend removing the earlier version from ticalc so that people don't get confused and so that everyone downloads the newest version.
@mdr1: Thanks for the reports (I don't have acces to OS 3.1, so I can't debug it)! I think I know how to fix the menu; if you have acces to the code via the student software you can fix it like this: Put "createMenu()" somewhere in the end of the code, to call it during initialization. I will also fix this in the next update.
The other problem with the start menu is more difficult to solve, because I don't have much information about it and right now I can't think of any possible cause... Does this error only occur on this dialogue? What about using [tab] or other arrow keys?
PS: I now have updated the first post with current screenshots, current version and stuff. ;)
It seem really great ! ;DIt's already implemented, just press/click on + or - on the "Patterns" list ;)
Just one thing, I remember we talked about a system of priorities for the syntax highliting, would it be possible to add it or is it to long ? :)
Anyway, good job :thumbsup:
--disable specific arrow key events (to trigger the on.arrowKey(direction) event)
on.arrowUp=false
on.arrowDown=false
on.arrowRight=false
on.arrowLeft=false
I just discovered this amazing editor! ;D But on on OS 3.1 pressing an arrow key on the editor page causes it to crash with error, "attempt to call a boolean value." I was able to fix it by deleting this part:Code: [Select]--disable specific arrow key events (to trigger the on.arrowKey(direction) event)
on.arrowUp=false
on.arrowDown=false
on.arrowRight=false
on.arrowLeft=false
But I'm wondering how nobody pointed this out yet; those lines have been there since v2.0A4!Well, if you look deeper in the topic, you will find that I had already reported such bugs:
Bug report: It is possible to go to the next item on the auto-completion menu with the return key but the arrow keys throw an "attempt to call a boolean value".
EDIT: And [Shift] + [down key] at any time throws the same error.
Thanks again for this editor!
Though, in JSE 2.0, there is no menu and clicking on the right key at the start menu (choose between a touchpad, clickpad or computer) throws the following error:
(http://img11.hostingpics.net/pics/260213capture.png)
About the autompletion menu, should it be possible to auto-activate it? And some keywords like "function" or "for" should come with a space.
EDIT: I achieved to show the menu: just go to the home screen and then return to the document.
Hi Jens_K! You've made a really great script editor! Everything that I needed to know was either in the readme, self-explanatory, or understood through trial-and-error. I just can't figure out one thing; How do you run a script? I get that you have to press MENU > Code > Run, but I switch to the Run page and can't figure out what I'm doing! It says Click to run, but I click the center button, and nothing happens. Sometimes it returns an error that won't solve (even when pressing Menu and trying to let the editor solve the error). I'm on a Clickpad running OS 3.6, if that makes any difference at all.
Thank you so much Jens! That worked. Like I said, I'm enjoying using the editor! It really has a UI like one of a computer IDE.Hi Jens_K! You've made a really great script editor! Everything that I needed to know was either in the readme, self-explanatory, or understood through trial-and-error. I just can't figure out one thing; How do you run a script? I get that you have to press MENU > Code > Run, but I switch to the Run page and can't figure out what I'm doing! It says Click to run, but I click the center button, and nothing happens. Sometimes it returns an error that won't solve (even when pressing Menu and trying to let the editor solve the error). I'm on a Clickpad running OS 3.6, if that makes any difference at all.
Hey, thanks for your feedback!
Seems like on the execution page (usually 1.2), you're focusing the console, but the script executor waits with execution until it has the focus itself. To change focus you can press ctrl + tab. The script executor should then have a black outline instead of a grey one.
I hope that helped. If it didn't, please send me your JSE file and some more infos about those errors! ;)
while true do
function on.paint(gc)
function textDisp(x,y,str)
gc:drawString(str,x,y)
end
end
platform.window.invalidate()
end
I've tested that whole code block without the while block, yet it doesn't work with the while. Is there a problem with my code? Or could it be the editor?
Hi Jens, another issue I'm having: I'm trying to run a script with several parts. I can't seem to run this code, it always takes extremely long, presumably forever, to load page 1.2:Nspire Lua programs have a different structure, they are event based; code outside of event handlers is usually only executed at the programs start and only for initialisation, which in your case takes an infinite amount of time due to your while loop, which is why your program doesn't respond.Code: [Select]while true do
I've tested that whole code block without the while block, yet it doesn't work with the while. Is there a problem with my code? Or could it be the editor?
function on.paint(gc)
function textDisp(x,y,str)
gc:drawString(str,x,y)
end
end
platform.window.invalidate()
end
x = 0
timer.start(0.01)
function on.timer()
x = x + 1
--update screen
platform.window:invalidate()
end
function on.paint(gc)
gc:drawString("hi", x % 300, 20)
end
But you don't have to update the screen repeatingly, whenever the Nspire forgets the screens content, it asks for an update by calling on.paint.Oh, okay, I didn't know they were entirely event-based. Thanks so much for your help, and sorry for the false report. I don't think I'll need any more help, but if I do, I'll ask somewhere; not here. Again, thanks!Hi Jens, another issue I'm having: I'm trying to run a script with several parts. I can't seem to run this code, it always takes extremely long, presumably forever, to load page 1.2:Nspire Lua programs have a different structure, they are event based; code outside of event handlers is usually only executed at the programs start and only for initialisation, which in your case takes an infinite amount of time due to your while loop, which is why your program doesn't respond.Code: [Select]while true do
I've tested that whole code block without the while block, yet it doesn't work with the while. Is there a problem with my code? Or could it be the editor?
function on.paint(gc)
function textDisp(x,y,str)
gc:drawString(str,x,y)
end
end
platform.window.invalidate()
end
You can see the available events in the Nspire API guide (on page 2.1).
To do what you wanted to do, you could use the timer to refresh the screen repeatingly:Code: [Select]x = 0
But you don't have to update the screen repeatingly, whenever the Nspire forgets the screens content, it asks for an update by calling on.paint.
timer.start(0.01)
function on.timer()
x = x + 1
--update screen
platform.window:invalidate()
end
function on.paint(gc)
gc:drawString("hi", x % 300, 20)
end
If you have further questions, you can ask here: https://www.omnimaga.org/lua-language/ (https://www.omnimaga.org/lua-language/) or send me a PM ;)