Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

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.

Show posts Menu

Topics - Strontium

#1
So I've installed ControlX (wew that was a spooky process), and I'd like to delete BtMg because I don't want to accidentally screw anything up with it. I don't fully understand the purpose of BtMg or how it works though, so I don't know if I need to keep it around. Thanks.
#2
General Help & Troubleshooting / HP Prime dead?
August 18, 2016, 05:32:28 AM
Hi,

I started charging my HP Prime the other day to top the battery out for when school started. However, since then, it seems that it shows no sign of life. I have ensured that the problem is not my cable, and I started charging the battery when it was nearly full (or, at least, more than 50%) so there should've been power in it anyways.

The only thing that I can think of being wrong is the fact I accidentally charged it using a Samsung "fast charger" instead of a standard USB wall plug.

It's also been suggested that my calculator may have been bricked by OS 10077, however, I have not updated my calculator since I got it and I am fairly sure that version of the OS has never been on it.

Is my calculator dead?
#3
I'm working on my own game! It's a roguelike, and I am trying to incorporate horror and story elements in it as well.

It mostly exists as a bunch of ideas and notes and a few tests for various parts of it.

The following are basically my notes of ideas for the game condensed into something  slightly more coherent. They don't form a story yet.
Because of the fact they are still pretty incoherent I'm gonna just spoiler them:

[spoiler]
WORLD:
Small town and a massive tower on a circular plot of land floating in a void. Sky around is a light purple. The town has shops and NPCs that you can talk to and buy stuff from. Slowly as you play, the land will slowly fall away starting from the outermost tiles of the island, and these tiles will continue to fall away until they reach the tower, at which point the bottom of the tower upwards will also slowly fall away. The townspeople are far too scared to go into the tower (for a good reason, I'll talk about it later) and eventually all huddle up in the center of the town, until they fall anyways.

THE TOWER:
Cultist wizard dude lives at the top of the tower and has all sorts of weird stuff. He's pretty much an unknown dude both in-character wise and to me. Not that it matters much. Lots of weird stuff in the tower, its dark and murky and stuff. Lots of weird alchemical tools, herb gardens, whatever. This weird stuff is what'll make the progression of most skills happen - finding old bits of knowledge and tools in various dedicated rooms.

More note-type stuff, still pretty incoherent (soz):

For the most part, it will have a lot of standard roguelike elements, as well as horror elements. Mostly playing on fear of the unknown. Also things like blood trails that will be left behind you if you get hit by a sharp weapon that monsters can detect and follow. AI's that can let me have descriptions like "something moves in the shadows, just outside of view" what have you.
[/spoiler]

Technical info:

* I'm writing it in Rust. I like rust. Its a nice language. I'm using Rustbox for interfacing the terminal. Rustbox is a set of bindings to Termbox.
* There will be two types of things: Tiles, and Entities. Tiles are stuff that make up a map: Walls, floors, etc. Everything else is an entity with events and metadata. Items, monsters, etc. Every entity has every event implemented, but are not required to respond to them. If they don't respond, the event returns false. If they do respond, the event returns true.
* Frontend and backend will be totally seperated so if I want to switch from Rustbox to some graphics library in the future, it will be super easy.
* uhhhh

Heres screenshots of the various parts I have been working on:


That is testing the very beginnings of the map generator and the entity system.


That is testing room basic room generation. Its much more impressive behind the scenes, since its actually working with my Tiles system.

...

Oh, turns out I don't have that much.. BUT THE ACTUAL PROJECT IS STILL IMPRESSIVE OKAY.

Anyways, once I get it to the point its maintainable I'll make a git repo. Right now I'm just working on basic features, scrapping it, and starting over until I get the architecture right.

Stay tunnnnnnnned~

edit: oh right I forgot, Epsilon is the codename until I can come up with something meaningful
#4
Gaming / Factorio
March 09, 2016, 03:36:56 AM
Factorio is a top-down game about building factories and automating EVERYTHING! In fact, its essentially impossible to progress without automation and building cool setups for everything. Organization, planning, and problem solving play a HUGE role. The goal of the game, right now, is to launch a rocket, which is a massive effort.




A whole lot of awesome things are possible. For example, heres a small factory made by Zisteau (a somewhat popular youtuber) which helped him complete the game for the first time:
[spoiler]



[/spoiler]
His factory uses a (fairly popular) design called a "main bus" where the most important items used in production are put on a massive conveyor belt so that production lines further down can use them more easily without needing their own system to produce the same items.

Some people have made things frequently referred to as "megabases," absolutely MASSIVE factories [often] designed to be able to launch as many rockets as possible within a short timeframe, or just generally be awesomely huge!


There are also quite a few very large, very game changing mods like DyTech and Bobs Mods - DyTech is designed to make the game a bit more challenging, and Bobs Mods are designed to expand the production trees a lot.

Heres an example of a very big base made using DyTech:


In my own world, I've just finished automating green science packs (science packs are used for researching more tech). Heres the factory so far:


I DEFINITELY recommend this game. It got launched on steam recently, and is available for $20 (US).
#5
How do I load an image into a GROB on the HP Prime? I want to load in a sprite sheet I got, and use SUBGROB_P to draw separate sprites.if I used any wrong terminology here please tell me
#6
Are you happier now? <3
Edit: 1+1+1 == 3
half life 3 confirmed
#7
Gaming / The Powder Toy!
May 17, 2015, 09:34:45 PM
I recently discovered The Powder Toy and its a really awesome game. You can create anything from a basic 8 bit computer (with RAM and everything!) or a nuclear reactor. So, here's a thread to post your creations!

Heres my powder based power plant, for example:
[spoiler][/spoiler]
http://powdertoy.co.uk/Browse/View.html?ID=1790747

It works by disintegrating (nearly) every type of dust with acid. This produces heat, which is conducted through the gold, heating up the water and turning it into water vapor.

Here is a deuterium-based nuclear reactor I made:
[spoiler][/spoiler]
http://powdertoy.co.uk/Browse/View.html?ID=1790646

This one works by releasing a few neutrons into a tank filled with deuterium, causing even more neutron to be created, and generates lots of heat. Its controlled by using SPRK on both of the wires. The upper one releases some neutrons, the other releases deuterium. Once you release the first neutron, the only thing you have to do to keep it running it supply more deuterium.

Of course, my contraptions are pretty lame. Here are some much more amazing things:
World Generator: http://powdertoy.co.uk/Browse/View.html?ID=1253965
Plutonium Reactor: http://powdertoy.co.uk/Browse/View.html?ID=257313
Computer (prints Pascals Triangle by default): http://powdertoy.co.uk/Browse/View.html?ID=1570768
Another computer (much more interesting to look at :P): http://powdertoy.co.uk/Browse/View.html?ID=427363
#8
Hello! I have ported greed (a CLI game for Linux created by Matthew Day) to the TI-Nspire CX. And it supports OS 3.1 and 3.6 this time :P



Instructions (slightly modified from the original):
The object of Greed is to erase as much of the screen as possible by moving around in a grid of numbers. Your location is signified by the 'P' symbol. When you move in a direction, you erase N number of grid squares in that direction, N being the first number in that direction. Your score reflects total number of squares eaten. Greed will not let you make a move that would have placed you off the grid of over a previously eaten square.

It *almost* perfectly mimics the original. It is missing three features:
-scoreboards (who cares!)
-loss detection (just press 5 to reset instead :P)
-possible move highlighting

There are always going to be a few bugs, of course

TODO:
only redraw the bits that need to be redrawn, in order to speed things up

Old post for posterity:
[spoiler]
Hello! I have ported greed (a CLI game for Linux created by Matthew Day) to the TI-Nspire CX. Currently, it only supports OS 3.9 & OS 4.0, but if someone wants to backport it for me, go ahead.



Directions (slightly modified from the original greed directions):
The object of Greed is to erase as much of the screen as possible by moving around in a grid of numbers. Your location is signified by the 'P' symbol. When you move in a direction, you erase N number of grid squares in that direction, N being the first number in that direction. Your score reflects total number of squares eaten. Greed will not let you make a move that would have placed you off the grid of over a previously eaten square.

Controls and your current score are on page 1.2, the directions are also written on page 1.3.

It's extremely close to the original. Its only missing the following three features:
- Automatic loss detection ('twas too lazy to implement it, just press 5 to reset instead)
- Possible move highlighting
- Scoreboard

Download attached.

EDIT: There is a bug where if you are right next to the left or right wall and try to move towards it, you will crash. I am trying to fix this, but have been unable to thus far.

EDIT2: Someone made an online version of Greed if you want to try it out before downloading my version: http://www.greedjs.com

EDIT3: I am going to rewrite this entire thing, since it is riddled with bugs and is spaghetti code.[/spoiler]
#9
I've been trying this issue I have been having for the past few hours, and I am extremely frustrated by it right now.

In the game I am working on, a port of the CLI game 'greed' for Linux. If the player tries to move right when their player is on the very right side of the screen (or if they try to move left when the player is on the very left side of the screen), the game crashes, with this error:

attempt to index field '?' (a nil value)

This happens in on.charIn, where the player movement code is.

Can someone help me with this? I have tried literally everything I can think of and it has not helped.

Current code:

-- colors {{color, style}, {color, style}}
local colors = {
  {"0xFFBF00", 'r'},
  {"0xB31B1B", 'r'},
  {"0x006B3C", 'r'},
  {"0x1560BD", 'r'},
  {"0x872657", 'r'},
  {"0xFFBF00", 'b'},
  {"0xB31B1B", 'b'},
  {"0x006B3C", 'b'},
  {"0x1560BD", 'b'},
}

function on.resize(w,h)
    -- font width & heights
    -- hardcoded because my other method only worked on the emulator for some reason
    strWidth, strHeight = 7,13
   
    -- window width & height
    winWidth, winHeight = w, h
   
    -- window width & height, character wise
    wincharWidth = math.floor(winWidth / strWidth)
    wincharHeight = math.floor(winHeight / strHeight)
   
    reset()
end

function reset()
    score = 0
    var.store('score', score)
    var.unmonitor('score')

    -- player location {x, y}
    player = {math.random(1, wincharWidth), math.random(1, wincharHeight)}
   
    -- generate board {{x, y}, {a, b}}
    board = {}
    for x = 1, wincharWidth do
      board[x] = {}
      for y = 1, wincharHeight do
        board[x][y] = math.random(1, 9)
      end
    end
    board[player[1]][player[2]] = nil
    platform.window:invalidate()
end
on.escapeKey = reset

-- set background color to black
platform.window:setBackgroundColor(0x000000)

-- controls
function on.charIn(char)
  -- WARNING:
  -- I use "notblocked" and "notblocked_" here a lot. I tried to be descriptive, k?

  -- make sure player isn't already moving
  if not isMoving then
    -- find how far and what direction to move the player
    if char == '1' then
      notBlocked, notBlocked_ = pcall(function() return board[player[1] - 1][player[2] + 1] end)
      print(notBlocked, notBlocked_)
      if not notBlocked or notBlocked_ then
        distance = board[player[1] - 1][player[2] + 1]
        destination = {player[1] - distance, player[2] + distance}

        isMoving = true
     
        -- make sure move is valid
        for i = 1, distance do
          notBlocked, notBlocked_ = pcall(function() return board[player[1] - i][player[2] + i] end)
          if not notBlocked or not notBlocked_ then
            isMoving = false
            break
          end
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] - i][player[2] + i] = nil
        end
     
        -- change player position
        player[1] = player[1] - distance
        player[2] = player[2] + distance
       
        -- increase score
        score = score + distance
       
        isMoving = false
      end
     
    elseif char == '2' and board[player[1]][player[2] + 1] then
      notBlocked, notBlocked_ = pcall(function() return board[player[1]][player[2] + i] end)
      if notBlocked or notBlocked_ then
        distance = board[player[1]][player[2] + 1]
        destination = {player[1], player[2] + distance}

        isMoving = true

        -- make sure move is valid
        for i = 1, distance do
          notBlocked, notBlocked_ = pcall(function() return board[player[1]][player[2] + i] end)
          if not notBlocked or not notBlocked_ then
            isMoving = false
            break
          end
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1]][player[2] + i] = nil
        end
     
        -- change player position
        player[2] = player[2] + distance

        -- increase score
        score = score + distance

        isMoving = false
      end

    elseif char == '3' and board[player[1] + 1][player[2] + 1] then
      distance = board[player[1] + 1][player[2] + 1]
      destination = {player[1] + distance, player[2] + distance}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1] + i][player[2] + i] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] + i][player[2] + i] = nil
        end

        -- move player
        player[1] = player[1] + distance
        player[2] = player[2] + distance

        -- increase score
        score = score + distance

        isMoving = false
      end

    elseif char == '6' and board[player[1] + 1][player[2]] then
      distance = board[player[1] + 1][player[2]]
      destination = {player[1] + distance, player[2]}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1] + i][player[2]] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] + i][player[2]] = nil
        end

        -- move player
        player[1] = player[1] + distance

        -- increase score
        score = score + distance

        isMoving = false
      end

    elseif char == '9' and board[player[1] + 1][player[2] - 1] then
      distance = board[player[1] + 1][player[2] - 1]
      destination = {player[1] + distance, player[2] - distance}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1] + i][player[2] - i] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] + i][player[2] - i] = nil
        end

        -- move player
        player[1] = player[1] + distance
        player[2] = player[2] - distance

        -- increase score
        score = score + distance

        isMoving = false
      end

    elseif char == '8' and board[player[1]][player[2] - 1] then
      distance = board[player[1]][player[2] - 1]
      destination = {player[1], player[2] - distance}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1]][player[2] - i] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1]][player[2] - i] = nil
        end

        --move player
        player[2] = player[2] - distance

        -- increase score
        score = score + distance

        isMoving = false
      end
     
    elseif char == '7' and board[player[1] - 1][player[2] - 1] then
      distance = board[player[1] - 1][player[2] - 1]
      destination = {player[1] - distance, player[2] - distance}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1] - i][player[2] - i] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] - i][player[2] - i] = nil
        end

        -- move player
        player[1] = player[1] - distance
        player[2] = player[2] - distance

        -- increase score
        score = score + distance

        isMoving = false
      end

    elseif char == '4' and board[player[1] - 1][player[2]] then
      distance = board[player[1] - 1][player[2]]
      destination = {player[1] - distance, player[2]}

      isMoving = true

      -- make sure move is valid
      for i = 1, distance do
        notBlocked, notBlocked_ = pcall(function() return board[player[1] - i][player[2]] end)
        if not notBlocked or not notBlocked_ then
          isMoving = false
          break
        end
      end

      if isMoving then
        -- clear spots
        for i = 1, distance do
          board[player[1] - i][player[2]] = nil
        end

        -- move player
        player[1] = player[1] - distance

        -- increase score
        score = score + distance

        isMoving = false
      end
    end
    var.store('score', score)
  end
 
  if char == '5' then
    reset()
  end
 
  platform.window:invalidate()
end

function on.paint(gc)
  -- render the board
  for x = 0, wincharWidth - 1 do
    for y = 0, wincharHeight - 1 do
      if board[x + 1][y + 1] then
        -- number appearance
        gc:setColorRGB(colors[board[x + 1][y + 1]][1])
        gc:setFont("sansserif", colors[board[x + 1][y + 1]][2], 10)
     
        -- draw number
        gc:drawString(board[x + 1][y + 1], x * strWidth, y * strHeight)
      end
    end
  end

  -- draw the player
  gc:setColorRGB(0xFFFFFF)
  gc:setFont("sansserif", 'r', 10)
  gc:drawString('P', (player[1] * strWidth) - strWidth, (player[2] * strHeight) - strHeight)
end


TL;DR if I move off the screen on the X axis, the program crashes. If I move of the screen on the Y axis, the program is fine.
#10
I am making a clone of Greed, a command line game for Linux, on my TI Nspire. It works fine, but it is horrendously slow (on calc, on the emulator it runs fine).

So far, I have only implemented moving the player around to clear the board. There is no code to make sure you make a valid move as of now.

My code so far is as follows:
-- make a global distance value, for some reason
distance = 0

-- font width & heights
-- hardcoded because my other method only worked on the emulator for some reason
strWidth = 7
strHeight = 13

-- window width & height
winWidth = platform.window:width()
winHeight = platform.window:height()

-- window width & height, character wise
wincharWidth = math.floor(winWidth / strWidth)
wincharHeight = math.floor(winHeight / strHeight)

-- colors {{color, style}, {color, style}}
colors = {
  {"0xFFBF00", 'r'},
  {"0xB31B1B", 'r'},
  {"0x006B3C", 'r'},
  {"0x1560BD", 'r'},
  {"0x872657", 'r'},
  {"0xFFBF00", 'b'},
  {"0xB31B1B", 'b'},
  {"0x006B3C", 'b'},
  {"0x1560BD", 'b'},
}
-- player location {x, y}
player = {math.random(1, wincharWidth), math.random(1, wincharHeight)}

-- is the player moving
isMoving = false

-- generate board {{x, y}, {a, b}}
board = {}
for x = 1, wincharWidth do
  board[x] = {}
  for y = 1, wincharHeight do
    board[x][y] = math.random(1, 9)
  end
end
board[player[1]][player[2]] = nil

-- set background color to black
platform.window:setBackgroundColor(0x000000)

-- game loop
function on.timer()
  -- move player
  if isMoving == true then
    -- operate in the appropriate direction
    if direction == 1 then
      -- clear next spot
      board[player[1] - 1][player[2] + 1] = nil
     
      -- change player position
      player[1] = player[1] - 1
      player[2] = player[2] + 1
    elseif direction == 2 then
      -- clear next spot
      board[player[1]][player[2] + 1] = nil
     
      -- change player position
      player[2] = player[2] + 1
    elseif direction == 3 then
      -- clear next spot
      board[player[1] + 1][player[2] + 1] = nil
     
      -- change player position
      player[1] = player[1] + 1
      player[2] = player[2] + 1
    elseif direction == 6 then
      -- clear next spot
      board[player[1] + 1][player[2]] = nil
     
      -- change player position
      player[1] = player[1] + 1
    elseif direction == 9 then
      -- clear next spot
      board[player[1] + 1][player[2] - 1] = nil
     
      -- change player position
      player[1] = player[1] + 1
      player[2] = player[2] - 1
    elseif direction == 8 then
      -- clear next spot
      board[player[1]][player[2] - 1] = nil
     
      -- change player position
      player[2] = player[2] - 1
    elseif direction == 7 then
      -- clear next spot
      board[player[1] - 1][player[2] - 1] = nil
     
      -- change player position
      player[1] = player[1] - 1
      player[2] = player[2] - 1
    elseif direction == 4 then
      -- clear next spot
      board[player[1] - 1][player[2]] = nil
     
      -- change player position
      player[1] = player[1] - 1
    end
    -- stop moving if the player reaches its destination
    if player[1] == destination[1] and player[2] == destination[2] then
      isMoving = false
    end
  end
  platform.window:invalidate()
end
timer.start(0.01)

-- controls
function on.charIn(char)
  -- make sure player isn't already moving
  if isMoving == false then
    -- move player
    if char == '1' then
      direction = 1
      distance = board[player[1] - 1][player[2] + 1]
      destination = {player[1] - distance, player[2] + distance}
      isMoving = true
    elseif char == '2' then
      direction = 2
      distance = board[player[1]][player[2] + 1]
      destination = {player[1], player[2] + distance}
      isMoving = true
    elseif char == '3' then
      direction = 3
      distance = board[player[1] + 1][player[2] + 1]
      destination = {player[1] + distance, player[2] + distance}
      isMoving = true
    elseif char == '6' then
      direction = 6
      distance = board[player[1] + 1][player[2]]
      destination = {player[1] + distance, player[2]}
      isMoving = true
    elseif char == '9' then
      direction = 9
      distance = board[player[1] + 1][player[2] - 1]
      destination = {player[1] + distance, player[2] - distance}
      isMoving = true
    elseif char == '8' then
      direction = 8
      distance = board[player[1]][player[2] - 1]
      destination = {player[1], player[2] - distance}
      isMoving = true
    elseif char == '7' then
      direction = 7
      distance = board[player[1] - 1][player[2] - 1]
      destination = {player[1] - distance, player[2] - distance}
      isMoving = true
    elseif char == '4' then
      direction = 4
      distance = board[player[1] - 1][player[2]]
      destination = {player[1] - distance, player[2]}
      isMoving = true
    end
  end
end

function on.paint(gc)
  -- render the board
  for x = 0, wincharWidth - 1 do
    for y = 0, wincharHeight - 1 do
      if board[x + 1][y + 1] ~= nil then
        -- number appearance
        gc:setColorRGB(colors[board[x + 1][y + 1]][1])
        gc:setFont("sansserif", colors[board[x + 1][y + 1]][2], 10)
     
        -- draw number
        gc:drawString(board[x + 1][y + 1], x * strWidth, y * strHeight)
      end
    end
  end
 
  -- draw the player
  gc:setColorRGB(0xFFFFFF)
  gc:drawString('P', (player[1] * strWidth) - strWidth, (player[2] * strHeight) - strHeight)
end

If someone could help me speed it up, that would be great.

Also, obligatory screenshot:

#11
NOTICE: There is a git repo available here: https://gitlab.com/Strontium/flowers

I am creating a game where you program a plants DNA to allow it to survive in the given environment. DNA is edited in segments of four, and each segment does a different thing. So a segment dedicated to leaves could allow you to change the type of leave, wether that means its a light leaf, dark leaf, fuzzy leaf, whatever. (Yes, each type of leaf in nature has its pros and cons, they are not just like that to look pretty!)

For each plant you create, there will be some undocumented DNA segments that randomly generate in a different place each time. It is up to you to experiment with the undocumented ones to see what they do & utilize them.

You can see how much water, nutrients, and sunlight your plant it getting (all relative to its size) in the stats screen:

(the white borders are a bug in the emulator :P)

There will also be a screen where you can see your plant, and observe the environment. How much rain? How much sun? How good is the soil? Using what you can see on this screen will help you create your plant.

My TODO list, in order of priority:
-- finish stats screen (complete)
-- finish plant visualizer
-- make DNA editor
-- write the simulation code
-- score & failure screens

After the contest I am going to allow myself to expand into 8x6 or maybe 12x9 so I can add more features in stuff in order to make it more intuitive and fun.
#12
I was disappointed at the lack of roguelikes available for the TI Nspire. As such, I am making my own! So far, I have added primitive monsters and the ability to move the player.



TODO LIST
High priority:
Monster AI
Combat
Monster levels
Random dungeon generation
Potions, ranged weapons, melee weapons, amour, rings, etc.
Shops
Various stats (I wont implement speed since that is a pain in the arse to add)

Low priority:
Colors (for example, coloring goblins green)

For the AI, I am planning on doing something like Angband where all monsters are generated sleeping, and are woken up when a player gets near them or does something to wake them up. Then, the player will generate a "scent" that extends for ~30 tiles, with the highest values next to the player and the lowest value far-est from the player. The monster will try to move the the highest number it can access until it reaches the player.

I have never made a game before, and need ideas for things to implement, so feel free to shoot ideas at me!

Current source (too lazy to zip this up and attach it):
-- character info
playerx = 5
playery = 5
playerhp = 100

-- MONSTER CLASS THINGY
-- monster constructor
MonsterGen = {}
function MonsterGen:new(x, y, icon)
  o = {x = x, y = y, icon = icon}
  setmetatable(o, self)
  self.__index = self
  return o
end

-- move monster
function MonsterGen:move()
  -- temporary movement
  -- I will soon make this an algorythm to move towards the player
  self.x = self.x + 1
  self.y = self.y + 1
end
-- end monster class thingy

-- event handlers
function on.paint(gc)
  -- draw player stats
  gc:drawLine(260, 0, 260, 240)
  gc:drawString("HP", 265, 15)
  gc:drawString(tostring(playerhp) .. "/100", 265, 30)

  -- draw all the monsters
  for mono = 1, 2 do
    gc:drawString(monster[mono].icon, monster[mono].x * 20, monster[mono].y * 20)
  end
  -- draw the player
  gc:drawString('@', playerx * 20, playery * 20)
end

function on.charIn(char)
  -- entries with turnTaken() cause the player to take a turn
 
  -- begin movement
  if char == '7' then
    -- move upleft
    playerx = playerx - 1
    playery = playery - 1
    turnTaken()
  elseif char == '8' then
    -- move up
    playery = playery - 1
    turnTaken()
  elseif char == '9' then
    -- move upright
    playerx = playerx + 1
    playery = playery - 1
    turnTaken()
  elseif char == '6' then
    -- move right
    playerx = playerx + 1
    turnTaken()
  elseif char == '3' then
    -- move downright
    playerx = playerx + 1
    playery = playery + 1
    turnTaken()
  elseif char == '2' then
    -- move down
    playery = playery + 1
    turnTaken()
  elseif char == '1' then
    -- move downleft
    playerx = playerx - 1
    playery = playery + 1
    turnTaken()
  elseif char == '4' then
    -- move left
    playerx = playerx - 1
    turnTaken()
  end
  -- end movement
  -- begin activities
  if char == '5' then
    -- wait
    turnTaken()
  end
  -- end activities
end

-- perform various processes after player turn
function turnTaken()
  -- perform monster-ly processes
  for mono = 1, 2 do
    monster[mono]:move()
  end
  platform.window:invalidate()
end

monster = {}
monster[1] = MonsterGen:new(1, 1, 'k')
monster[2] = MonsterGen:new(3, 3, 'g')
#13
I am working on a roguelike for my TI Nspire CX. So far, everything works fine in the emulator, but on the calculator, I cannot use the arrow keys to move. Here is the code:

-- character info
playerx = 5
playery = 5
playerhp = 100

-- MONSTER CLASS THINGY
-- monster constructor
MonsterGen = {}
function MonsterGen:new(x, y, icon)
  o = {x = x, y = y, icon = icon}
  setmetatable(o, self)
  self.__index = self
  return o
end

-- move monster
function MonsterGen:move()
  -- temporary movement
  -- I will soon make this an algorythm to move towards the player
  self.x = self.x + 1
  self.y = self.y + 2
end

-- end monster class thingy

-- event handlers
function on.paint(gc)
  -- draw player stats
  gc:drawLine(260, 0, 260, 240)
  gc:drawString("HP", 265, 15)
  gc:drawString(tostring(playerhp) .. "/100", 265, 30)

  -- draw all the monsters
  for mono = 1, 2 do
    gc:drawString(monster[mono].icon, monster[mono].x * 20, monster[mono].y * 20)
  end
  -- draw the player
  gc:drawString('@', playerx * 20, playery * 20)
end

function on.arrowLeft()
  -- move player left
  playerx = playerx - 1
  turnTaken()
end

function on.arrowRight()
  -- move player right
  playerx = playerx + 1
  turnTaken()
end

function on.arrowUp()
  -- move player up
  playery = playery - 1
  turnTaken()
end

function on.arrowDown()
  -- move player down
  playery = playery + 1
  turnTaken()
end

-- perform various processes after player turn
function turnTaken()
  -- perform monster-ly processes
  for mono = 1, 2 do
    monster[mono]:move()
  end
end

monster = {}
monster[1] = MonsterGen:new(1, 1, 'k')
monster[2] = MonsterGen:new(3, 3, 'g')


I have no idea what is causing the movement to work on the emulator but not the calculator. At all. And I need help fixing it.

Edit: Ha! I figured it out. I forgot to call platform.window:invalidate() after each turn.

Woops.
#14
I seem to always have my calculator with me, and have often used it to see in the dark. But I needed a better way to do this! So, I created TiLight (pronounced Tie Light).

Its very simple, but its my first real project for my calculator. The source code is included in the download.

Use the up arrow key to increase the brightness, and the down arrow key to decrease the brightness. There are also some presets in the menu.
#15
As in, what exploits does it use, and how it allows native programs to run.

Also, does a persistent version of Ndless for OS 3.9 ever have a chance to exist?
#16
I've been messing around with Lua on my TI Nspire, and made a thing that allows you to move a square around and draw a line when you press 6. The code, so far, is as follows:
player_pos = {100, 100}
atacking = false

function attackLeft()
    if attacking == false then
        attacking = true
    else
        attacking = false
    end
end

function on.arrowUp()
    player_pos[1] = player_pos[1] - 1
end

function on.arrowDown()
    player_pos[1] = player_pos[1] + 1
end

function on.arrowLeft()
    player_pos[2] = player_pos[2] - 1
end

function on.arrowRight()
    player_pos[2] = player_pos[2] + 1
end

function on.charIn(char)
    if char == "6" then
        attackLeft()
    end
end

function on.timer()
    platform.window:invalidate()
end

timer.start(0.1)

function on.paint(gc)
    gc:drawRect(player_pos[2], player_pos[1], 20, 20)
    if attacking == true then
        gc:drawLine(player_pos[2] + 20, player_pos[1] + 10, player_pos[2] + 75, player_pos[1] + 10)
    end
end


Its just a prototype I hacked together. Some things in it dont even make sense (for example, how I dealt with the player position). However, there is something I have a question about:

When I hold down any of the direction arrows, then press 6 to draw the line, the player stops moving in x direction. I know why this is, though, its because when I press 6 the program stops receiving input from the arrows. However, I want to be able to continue moving even after I press 6. How would I do this?

Edit: Also, is there a function that prevents the calc asking you if you want to save when you close out the application?
#17
I've had an idea, but I don't know much about the inner workings of  the Nspire series so I am not sure if it will work:

I tried sending the CAS software to my non-CAS calculator via the CX Student Software, and it refused, saying "wrong OS type". If the only thing preventing the CAS OS from being installed is the CX Student Software saying no, then could you trick the software into sending the CAS OS anyways using a little trickery?

Another reason why I see this a possibility is that you can only send files ending in .tns to the calc, but you can create and rename them to other things (using Ndless programs, of course) to not use .tns. Since the calculator does not check the file type on the calc, maybe the same thing happens with the OS.

I'm not sure if thats even possible, or how it would be done.
Powered by EzPortal