Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jonius7

Pages: 1 ... 31 32 [33] 34 35 ... 129
481
Lua / Re: Numstrat - Stumbling into Lua
« on: April 04, 2012, 06:37:07 am »
to mak eit only display 2 decimals after the comma, you can do math.floor(average*10)/10. I don't know if there's another way to do this, but that's my way :) And i don't think there's an easy way to make it only have to decimals at all...

and i think it's faster to put twice t = t+1 than if since if is a statement, the other one just an addition, which is faster

a table is te same as a list in lua, you don't have two dimensional things. just do e.g.
Code: [Select]
function on.create()
     vars = {0, 0, 0, 2, 0, 2}
end

--this must in the if ch=="a" thingie

if vars[3] = 0 then
     vars[1] = vars[1]+1
end
[code]

this might be a bit more timeconsuming to type, but it think it's more beautiful to see, rather than 5 vars :)
 
[/code]

Thanks Nick, I shall update this if I have time.
From what I gather table is equivalent to list
and an array is equivalent to matrix
Thanks!
Hopefully this will just be the beginning of my Journey in Lua :D

482
TI Z80 / Re: Dimension Shift
« on: April 04, 2012, 04:53:04 am »
Is this an updated version to the contest entry btw? (Axe Contest) Btw it really looks nice. Are you planning to put it in the staff downloads section?
This definitely does look like it as I see ephan saying words like judging and contest.
Lol necropost DJ_O
:P
The graphics in this game look great, I haven't played the PC version though.

483
News / Re: An official TI-Nspire theme editor!
« on: April 04, 2012, 04:47:57 am »
I wouldn't bet on a release of that tool anytime.
Awww, that would have been the very best!!! A release of the theme editor, able to change the TI-nspire theme TI has "forced" on us. But it looks not to be.

484
Miscellaneous / Re: ClrHome seized?
« on: April 04, 2012, 03:30:12 am »
I love the 1984 reference!  Deep, that's awesome!
What is the 1984 reference? ???
INGSOC - English Socialism
And the party slogans around it.
War is Peace
Freedom is Slavery
Ignorance is Strength
If you don't know what I am talking about, then I strongly recommend you read Nineteen Eighty-Four by George Orwell. One of the best books of all time
I like the overall design of the logo :D
Very nice, had me tricked there for a moment, reminded me of megaupload.

485
Miscellaneous / Re: Ticalc.org fools day
« on: April 04, 2012, 03:18:22 am »
I knew something was different with the green border, but I thought it was something like important news and I believed it for a while. Damnit! I even replied!
But good to see it is now fake news with the red border.

486
Lua / Re: Numstrat - Stumbling into Lua
« on: April 04, 2012, 02:59:18 am »
Thanks Nick! That's a great summary of things to fix.
Most of that stuff I was partly aware of already, but just hadn't put in yet.
- So how about if I wanted to display the average up to 2 decimal places? i.e. Fix2?
- cha=ch probably because I changed it from a getchar program I got from jimbauwens and just left it there
- Yes on.create() was what I was looking for thanks
- For a table is that different to a matrix/array/list?
- "if cha=="a" or cha=="d" then if cha=="a" then.." I think I did that because there is t=t+1 at the end. But it would make more sense (and save more space), to put t=t+1 inside the if cha=="a" and if cha=="d" I think then.

Thanks for the help!
I used http://wiki.inspired-lua.org/ for some help.

487
TI-Nspire / Re: TNS>LUA Converter
« on: April 04, 2012, 02:52:06 am »
You better use Luna to create .tns file, that any other third-party tool, since Luna is the only one generating working file for OS >= 3.0.2.

Tutorials on how to use it are everywhere, but basically :   luna.exe source.lua output.tns


EDIT : Oh wait nevermind I think I read your post wrong.....



No no, adriweb

On my other topic http://ourl.ca/15678/294355 I mention about Luna and stuff.

And, Luna is LUA -> TNS
But Ephan's python script is TNS -> LUA
jimbauwens did mention some ways to get the source code from the tns but I'm not sure how they work.
Also I have some suspicions that TNS>LUA Converter may not work on OS >=3.0.2 files anymore, and this was created before OS 3.0.2
Still I would like to know how to run this thing...

488
Music Showcase / Re: Jonius7's Finale Music
« on: April 04, 2012, 02:36:18 am »
Sounds awesome. :D

Quote
Also funny how you say it would fit in a video game, as people in my class commented on one of my previous melodies (Jason's Melody No.7, despite the numbering), that it would suite a video game too.

I understand. :D DJ commented ALL my songs that those will fit in RPG games O.o
Oh lol that just made DJ_O's comment seem so devalued :P

But I guess DJ_O has Frozen danger and Superstar Hero as actual RPG songs (an incomplete RPG however) :D

489
Lua / Numstrat - Stumbling into Lua
« on: April 04, 2012, 02:27:10 am »
Hi everyone,
I haven't been active much on the forums in the past few days (in comparison with the past few months), but I have created a simple Lua program while experimenting on oclua. I have transferred the code into a Lua file on the computer and here it is!
Basically you start with a value of 0 and you can choose to Attack or Defend to try and increase your value. right now I am experimenting with the points system as Attack carries no more risk than Defence and both are as equally likely to win as to lose.

Here is also the source code. Feel free to look through it, comment on my program, how my coding is, any improvements on optimising it or making it easier for another programmer to read, and stuff. The more feedback I get the more I can use the feedback to broaden my understanding of Lua!
Code: [Select]
--[[Things to do:
Declare variables first within a function
Make things more fun and complex
Points System:
OLD: Atk -{1,2,3} +{4,5} Def +{1,2,3} -{4,5}
NEW: Atk -{4,5} +{4,5} Def +{1,2,3} -{1,2,3}
Any better ways? Maybe make Atk more risky, so it's less about luck]]--
v=0
t=0
r1=0
r2=2
r3=0
r4=2
function on.paint(gc)
gc:drawString("[A]tk or [D]ef?    [R]eset",10,10,"top")
gc:drawString(v,10,30,"top")
if r2==1 then
gc:drawString("Attack was successful. +" .. r1,10,50,"top")
end
if r2==0 then
gc:drawString("Attack was unsuccessful. -" .. r1,10,50,"top")
end
if r4==1 then
gc:drawString("Defence was successful. +" .. r3,10,50,"top")
end
if r4==0 then
gc:drawString("Defence was unsuccessful. -" .. r3,10,50,"top")
end
gc:drawString("Turn " .. t,200,10,"top")
if v~=0 or t~=0 then
gc:drawString("Average " .. v/t,200,30,"top")
end
gc:setFont("sansserif","r",8)
gc:drawString("Numstrat - Jason Ho",10,200,"top")
end
function on.charIn(ch)
cha=ch
if cha=="a" or cha=="d" then
if cha=="a" then
r4=2
r1=math.random(4,5)
r2=math.random(0,1)
if r2==1 then
v=v+r1
end
if r2==0 then
v=v-r1
end
end
if cha=="d" then
r2=2
r3=math.random(1,3)
r4=math.random(0,1)
if r4==1 then
v=v+r3
end
if r4==0 then
v=v-r3
end
end
t=t+1
end
if cha=="r" then
v=0
t=0
r1=0
r2=2
r3=0
r4=2
end
platform.window:invalidate()
end

With my current knowledge, I think a Lua version of my TI-nspire Basic Game, Jason's TI-nspire Hold'em is achievable. I just need to get working on it, persistently ;)

Thanks everyone!

490
Lua / Re: 15Puzzle for TI-nspire Lua
« on: April 04, 2012, 02:17:29 am »
Anyway good to see that we won't have to take to such measures of making Lua scripts run in the future and can even edit the file directly (which means even better than Oclua on calc!). But to get back on topic
I want to try and understand completely what Goplat's 15 puzzle means. I've already learnt quite a bit, let's see what else there is. I have commented on this within the code :D
Code: [Select]
function on.charIn(ch) --called when a character key is pressed
if ch == "r" then --when r is pressed
board = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } --this is how you create arrays!
-- Randomize
local swaps = 0  -- a local variable (wonder why)
for i = 1, 16 do   -- ah this is the For...To syntax in TI-84 and Casio basic and other stuff
local j = math.random(i, 16)  -- local variable, random number from i to 16
if i ~= j then  -- i not equal to j
board[i], board[j] = board[j], board[i]     --swap number in position i and j?
swaps = swaps + 1  --swaps number of turns
end
if board[i] == 16 then  --reach the end
empty = i 
end
end

-- If the number of swaps plus the number of empty-space movements is odd,
-- then the puzzle is impossible, so do an impossible move to make it possible
-- (exchange the space with a tile two squares away)
if (swaps + (empty - 1) + math.floor((empty - 1) / 4)) % 2 == 1 then   -- not 100% how this works, I know this is a way to fix an impossible puzzle :P
local i = (empty + 7) % 16 + 1
board[empty] = board[i]
empty = i
board[empty] = 16
end

moves = 0
platform.window:invalidate()  --force redraw of the screen calls on.paint(gc)
end
end

on.charIn("r")

function on.paint(gc)
local won = true
for i, n in ipairs(board) do
if n ~= 16 then
local x = (platform.window:width() - 128) / 2 + 32*((i - 1) % 4)
local y = (platform.window:height() - 128) / 2 + 32*math.floor((i - 1) / 4)
gc:drawRect(x, y, 30, 30)
gc:drawString(n, x + (30 - gc:getStringWidth(n)) / 2, y + 15, "middle")
end
won = (won and n == i)
end

local str = moves .. " moves"
gc:drawString(str, (platform.window:width() - gc:getStringWidth(str)) / 2, 0, "top")
if won then
str = "You win! Press R to reset"
gc:drawString(str, (platform.window:width() - gc:getStringWidth(str)) / 2, platform.window:height(), "bottom")
end
end

function on.arrowKey(key)
local dir
if key == "left" and empty % 4 ~= 0 then
dir = 1
elseif key == "right" and empty % 4 ~= 1 then
dir = -1
elseif key == "up" and empty <= 12 then
dir = 4
elseif key == "down" and empty > 4 then
dir = -4
else
return
end
board[empty] = board[empty + dir]
empty = empty + dir
board[empty] = 16
moves = moves + 1
platform.window:invalidate()
end

491
News / Re: An official TI-Nspire theme editor!
« on: April 02, 2012, 04:47:29 am »
Hmm weird: Juju does say it varies in this particular post, which I think is the most updated version: http://ourl.ca/6827/274885

492
News / Re: An official TI-Nspire theme editor!
« on: April 02, 2012, 02:34:15 am »
Oh right I forgot the spam section required 1000 posts. X.x Anyway I moved it because there was no website URL in the post and you didn't add one. It would have been funny if you had one and it linked to some weird site or a redirect :P

I thought I could still post in spam long before 1000 posts though.
This might have been before the requirement was increased. Or maybe now it's 500?
Possibly, however I only reached 1000 posts last month and I remember posting in spam long before that.
Perhaps it also depends on registration date? Newer members may have this 1000 post restriction now or something. Or it varies as http://ourl.ca/68275 says

493
Miscellaneous / Re: They blocked Omnimaga at our school D:
« on: April 02, 2012, 02:16:46 am »
I did mention this several times before, but if it becomes hard or annoying to keep finding new proxies (most likely because they are getting blocked), there's always Tor https://www.torproject.org/

If you can, just put it on your USB (it's fully portable) and set the network settings to your school's ones and it should work! You can get it with portable Firefox which is even better and enjoy unrestricted browsing!

If anyone decides to try this, tell me, as there are some extra settings I might need to tell you about.

494
Humour and Jokes / Re: The Guthammer 6000
« on: April 02, 2012, 02:14:51 am »
I think we need HotDog to give us a whole heap of answers.

Maybe the $19000 shipping (lol :P) is mainly for security and weight reasons...

495
News / Re: Dump your TI-Nspire easily!
« on: April 02, 2012, 02:04:45 am »
Excale made a nice tutorial for using nspire_emu 0.60 on TI-Planet, in French: http://tiplanet.org/forum/viewtopic.php?f=15&t=8698 :)
Machine translation should do the job; if not, any takers for the translation work ? ;)

And the event mentioned as "As discovered by critor recently, it also allows you to get out of some bugs without having to batttery-reset the calc" by Adriweb is http://tiplanet.org/forum/viewtopic.php?t=8945 , again in French. The diags software happens to clear out the SRAM, which fixes some Nspire CX calculators which flat out refuse to boot properly (even calculators on which Ndless has never been installed exhibit the bug...), in a nicer way (especially during exams :D) than carrying a screwdriver around for opening the calculator's back to remove the battery :)

W00T I might translate that then and put that in the Omnimaga Tutorials section :D

Pages: 1 ... 31 32 [33] 34 35 ... 129