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

Messages - wizard_wizzle (aka ZeldaHistorian)

#256
Not sure if this is a bug in the engine or the fault of my script, but I get the error "Fatal: Non-empty stack after LuaContext::update()" when one of my enemies is on the screen after a few seconds. The enemy script is below:

local enemy = ...

-- Octorok: simple enemy who wanders and shoots rocks

local going_hero = false
local awaken = false
local timer

function enemy:on_created()
  self:set_life(1)
  self:set_damage(2)
  self:create_sprite("enemies/octorok_red")
  self:set_hurt_style("monster")
  self:set_pushed_back_when_hurt(true)
  self:set_push_hero_on_sword(false)
  self:set_size(16, 16)
  self:set_origin(8, 13)
end

function enemy:on_movement_changed(movement)
  local direction4 = movement:get_direction4()
  local sprite = self:get_sprite()
  sprite:set_direction(direction4)
end

function enemy:on_obstacle_reached(movement)
  if awaken and not going_hero then
    self:check_hero()
  end
end

function enemy:on_restarted()
  if not awaken then
    self:go_random()
  else
    self:go_hero()
  end
  self:check_hero()
end

function enemy:on_hurt()
  if timer ~= nil then
    timer:stop()
    timer = nil
  end
end

function enemy:check_hero()
  local hero = self:get_map():get_entity("hero")
  local _, _, layer = self:get_position()
  local _, _, hero_layer = hero:get_position()
  local near_hero = layer == hero_layer
    and self:get_distance(hero) < 100

  if awaken then
    if near_hero and not going_hero then
      self:go_hero()
    elseif not near_hero and going_hero then
      self:go_random()
    end
  elseif not awaken and near_hero then
    self:wake_up()
  end
  timer = sol.timer.start(self, 1000, function() self:check_hero() end)
end

function enemy:wake_up()
  self:stop_movement()
  local sprite = self:get_sprite()
  sprite:set_animation("shooting")
  local x, y, l = self:get_position()
  local sx, sy = 0
  if d == 0 then
    sx = x + 8
    sy = y
  end
  if d == 1 then
    sy = y - 8
    sx = x
  end
  if d == 2 then
    sx = x - 8
    sy = y
  end
  if d ==3 then
    sy = y +8
    sx = x
  end
  sol.timer.start(self, 1000, function()
    local rock = self:create_enemy{
      breed = "rock_small",
      x = sx,
      y = sy
    }
    rock:go(d)
    sol.timer.start(self, 2000, function()
      self:check_hero()
    end)
  end)
end

function enemy:go_random()
  local m = sol.movement.create("random")
  m:set_speed(32)
  m:start(self)
  d = m:get_direction4()
  going_hero = false
end

function enemy:go_hero()
  local m = sol.movement.create("target")
  m:set_speed(48)
  m:start(self)
  d = m:get_direction4()
  going_hero = true
end
#257
Development / Re: Cryptic error
February 05, 2014, 08:38:56 PM
Updating SDL worked perfectly! You are a genius, thanks!
#258
Development / Re: Cryptic error
February 05, 2014, 05:41:41 PM
Confirmed that it happens with zsdx as well. Is there something wrong on my system? Is there a way I can debug this?
#259
Development / Re: Cryptic error
February 05, 2014, 05:38:16 PM
That worked wonderfully - thank you! I'm slowly getting my scripts converted over to the new syntax, and I'm finding it to be much more concise and logical. Great job and thanks again for everything you've done with this engine!


Another oddity I encountered, except this one is graphical.



When I enter a map larger than the current screen, and move the character out of the initial drawing region, it appears that all of those tiles are never drawn (see above). The entities and dynamic tiles appear to be, but not the static tiles. If I leave and re-enter this map, say in a different area, a new region is drawn but I can once again move out of the drawn region.




Here's an image from the editor of what the area should look like,


I'm running Solarus 1.2.0 with 2D acceleration on (even stranger, if I run with acceleration off, I get no display at all - only a black screen) on Ubuntu linux 13.10.
#260
Bugs & Feature requests / Editor improvements
February 04, 2014, 05:34:36 AM
Christopho- mad props on the recent improvements to the editor - there are some great things there that really speed up development. Using the improved editor got me thinking of additional improvement potential, so I thought I'd post some here rather than making a bunch of issues on github (I can do that if you prefer).

  • A small "x" on each tab (for maps or whatever) to close it would be a huge time savings when you have several tabs open.
  • It would be nice (if possible) to have a small "play" button next to any drop-down selector for music. Sometimes I forget which music I want and being able to listed to several in the editor would be a great help. Or at least allow us to listen to the music when selecting it from the left pane?
  • When changing the id of an item in the left selector pane, the current id could be the default in the dialog.
  • Holding "control" and using the mouse wheel could zoom the view.
  • Making some tweaks to make the editor more friendly to smaller resolutions would be helpful - I have a machine running at 1024x768 and there are times when I can't see everything in a dialog box. One example is the new "destructible" dialog - would it be possible to lay things out differently so the dialog isn't so big?
#261
Development / Cryptic error
February 04, 2014, 05:17:40 AM
I was hoping I'd be able to get some help decrypting this error, because I don't understand why I'm getting one. I'm getting the following when I run my game:
Error: Failed to load script 'maps/1': [string "maps/1.lua"]:14: malformed number near '.0.shop_mushroom_done_dialog_finished'

The script around that line is:
  if destination == "main_entrance_shop" and game:get_value("i2021") == 10 then
    game:start_dialog("crista.0.shop_mushroom.7", crista.0.shop_mushroom_done_dialog_finished)
  end


And the function being called:
local function crista.0.shop_mushroom_done_dialog_finished()
  game:set_value("i3001", game:get_value("i3001")+1)
  hero:start_treasure("trading", 2)
end


I'm guessing it's related to changes in 1.2.0, since I don't recall having an error when running an earlier version.
#262
General discussion / Re: Welcome!
August 11, 2013, 07:11:15 PM
I think the description's a bit clearer now - sorry I didn't realize that was there!
#263
General discussion / Re: Welcome!
August 07, 2013, 01:58:28 AM
Yay! Thanks Christopho!

My suggestion: a board for the Solarus engine so we can come up with cool new lua scripts and what-not.