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 - Munchor

Pages: 1 ... 82 83 [84] 85 86 ... 424
1246
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 05:43:25 pm »
Phew, after a while, I managed to make my first program

Code: [Select]
print("Enter number: ")
max_value = io.read("*number")           --Get maximum random number
if type(max_value) == "number" then      --If the user enters a number

  math.randomseed( os.time() )
  random_number = math.random(max_value) --Define a number
 
  while true do
    print ("Guess a number: ")
    tried_number = io.read("*number")
    if type(tried_number) == "number" then
      if tried_number == random_number then
        print ("You Won")
        break
      end
    end
  end

else
  print("Not a Number!")
  end

I will still add a few checks and other stuff, but this language is not really for me.

EDIT:

Yay, added a few cool stuff:

Code: [Select]
print("Enter number: ")
max_value = io.read("*number")           --Get maximum random number
if type(max_value) == "number" then      --If the user enters a number

  math.randomseed( os.time() )
  random_number = math.random(max_value) --Define a number
 
  while true do
    print ("Guess a number: ")
    tried_number = io.read("*number")
    if type(tried_number) == "number" then
      if tried_number == random_number then
        print ("You Won")
        break
      elseif tried_number > random_number then
        print ("Try a lower number")
      else
        print ("Try a higher number")
      end
    else
      print ("Not a number!")
    end
  end

else
  print("Not a number!")
  end

1247
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 05:18:16 pm »
Code: [Select]
  print("Enter number: ")
  max_value = io.read("*number")
  if type(max_value) == "number" then
  for i=1,max_value,1 do print(i) end
  else
  print("Not a Number!")
  end
This seems to work.

Indeed it works, thanks a lot :D

1248
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 05:11:42 pm »
I'm more fluent in Lua syntax than most other languages, it's easy when you memorize it.

Then perhaps you can help me please?
The problem I have is the nSpire platform, I can't even make a loop to draw a screen.

Perhaps I should link you to the forum where this topic is.

Right here.

1249
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 04:59:59 pm »
I'm more fluent in Lua syntax than most other languages, it's easy when you memorize it.

Then perhaps you can help me please?

1250
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 04:59:26 pm »
Code: [Select]
get_num = function()
  print("Enter number: ")
  max_value = io.read("*number")
end
if type(max_value) == number then
  for i=1,max_value,1 do print(i) end
else
  print("Not a Number!")
end
This returns "Not a Number!".

Code: [Select]
get_num = function()
  print("Enter number: ")
  max_value = io.read("*number")
end
if type(max_value) == number then
  for i=1,max_value,1 do print(i) end
else
  print("Not a Number!")
  break
end

This returns "lua: helloworld.lua:10: no loop to break near 'end'."

1251
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 04:36:45 pm »
That code gave:

Code: [Select]
lua: helloworld.lua:6: 'then' expected near 'for'
I'm getting a bit pissed at Lua, the syntax is confusing.

1252
Computer Programming / Re: Lua Loop Defined By User
« on: May 31, 2011, 04:28:10 pm »
That code gave this to me:

Code: [Select]
lua: helloworld.lua:1: unexpected symbol near ';'

1253
Computer Programming / Lua Loop Defined By User
« on: May 31, 2011, 02:33:35 pm »
I'd like to know how to get input from the user (a number) and then looping the number the user entered.

So it'd work like this

Code: [Select]
Number: 2
Running through loop : 0
Running through loop : 1

Now, i can print and read from user:

Code: [Select]
print ("Enter number: ")
max_value = io.read()

My problem is looping max_value number of times, thanks.

1254
TI Z80 / Re: TI 3D modeller
« on: May 31, 2011, 02:08:45 pm »
I have no usb cable anymore, and I'm trying to do lines; just before vertical rotation.
If someone can say me how to convert xyz point + xy rotation to a xy point ... It'll be great better for the project.

You can use SourceCoder or TokenIDE to tokenize that code :)

Either way, I'd love a screenshot when you can.

1255
Axe / Re: Fast scroll to bottom of code editor
« on: May 31, 2011, 03:00:00 am »
This is the axe board >:( I know that trick, but axe is compiled, so it won't work :P
Any mods for the editor??

Nobody gave a mod, so I guess there isn't.

1256
Axe / Re: Axe Tilemapping 4*4
« on: May 31, 2011, 02:53:56 am »
So, I got some more of it and started coding, based on aeTIo's sample.

Code: [Select]
.TILEMAPR
.Tile data:
[FFFFFFFFFFFFFFFF->Pic1
[F0F0F0F0F0F0F0F0
[22222222->Pic1TL
[20000002
[20000002
[22222222

Repeat getKey(15)
.Draw the tilemap
For(A,0,3)
For(B,0,3)
If {Pic1TL+(A*4)+B}->C
-1->C
Pt-On(B*8,A*8,Pic1+(C*8))
End
End
DispGraph
End
End

But why is this code a lot of dots and two blocks on the right. I don't really get how changing Pic1TL affects the code.

EDIT: I actually think I got it, I'm changing half of a byte, and not an entire byte.

Yeah, changing bytes worked better.

1257
News / Re: The future of TI-BANK compromised?
« on: May 30, 2011, 04:18:38 pm »
This royally sucks. I hope you guys can recover some of the data and pick the pieces back up. =/

Jim Bauwens has a huge backup of the forum I think.

1258
Axe / Re: Fast scroll to bottom of code editor
« on: May 30, 2011, 04:12:14 pm »
When there is an error message it scrolls down rapidly to a line of code, so it is possible. (Lots of hackers hanging around here  ;D)

If you're using BASIC, one way to do that is to put a Pause or something at the end of the program, then run the program and get to that Pause and press ON to break > 2:Goto. You could also install DoorsCS 7 to use its Instant Goto.

How to use the Instant Goto in DCS7?

1259
Yay!  I've been on Omnimaga for one year, and it's been great!

anyway, I'm going to be gone/come on rarely for the next 3 weeks until June 24 because I'm going to China.  I'll be working on my contest entry while there, so expect lots of progress!

Woah, on China? Sounds pretty cool. Make sure to buy a "Chinatendo" and a "83- Bronze Edition". (jk)

1260
Axe / Re: can someone help me
« on: May 30, 2011, 03:40:32 pm »
Imagine the memory of your calculator is this:

Memory: AB0123456789ABCDEF00B0231253210214125124123123123122312AF2131231201012312312
Address: 0123456789...

Str1 is a pointer to the address 2, where the image starts in the memory.

(this is not really what happens, just an example).

Pages: 1 ... 82 83 [84] 85 86 ... 424