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 - gmanplays@gmail.com

Pages: [1]
1
Bugs & Feature requests / Re: Methods from OLB resources not working?
« on: February 11, 2019, 09:18:10 pm »
Oh jesus, you can search for specific terms on Github? God, I wish I was more observant. Thanks much my guy.

2
Bugs & Feature requests / Methods from OLB resources not working?
« on: February 11, 2019, 05:37:49 am »
Hey again,

    Firstly I'd like to thank everyone on the server for being so helpful whenever I come with an amateurish problem I don't know how to solve. Really lively community around here and I genuinely appreciate the help. Anyways, moving on.
I've recently been studying up via the Tutorials, and I started using some of the resources provided there, in one instance in particular: In the episode covering the hud, in the description lies a link to some scripts used in Oni-Link Begins, which I promptly downloaded and installed, as an easy solution to a problem that I've spent more than two days on. However, when I ran it, I got one exception from each the key item script, and the key hud script, respectively. From what the error entailed, it looks like the engine doesn't seem to be recognizing any method that includes keys as a non-nil value. I checked the documentation, and I couldn't find any of those methods myself either, which indicates to me that there must be another script which defines those methods. I proceeded to sift through the directory where I got those scripts, looking for any code that mentions "keys", other than the ones I found and installed already.

Here's the exceptions:

1)
Code: [Select]
Error: In on_started: scripts/hud/small_key.lua:19: attempt to call method 'are_small_keys_enabled' (a nil value)2)
Code: [Select]
Error: In on_obtaining: items/consumables/small_key.lua:12: attempt to call method 'add_small_key' (a nil value)
If anyone could help me sort out defining those methods, I'd be much obliged. Thanks much for your time.

3
Excellently done! Thank you very much. I'm new to coding, so what do you think went wrong with my loop?

4
Hey everyone, back after tiling a good portion of an overworld, and the entirety of my first dungeon, when I ran into a problem while I was making my project. I was attempting to create a simple script which enabled a chest to appear when all of the Ropes in the room were killed, until I got to the point through trial and error where I'd created a script I couldn't possibly refine anymore, but nonetheless failed to generate the desired result. Instead, it played the sound which indicates the appearance of a chest once the room was loaded. Consider the attached script. What do you think went wrong? Did I refer to the wrong prefix in the has_entities command? I'm not sure. Any help would be appreciated

Post-Script: Hey, I'm not sure where I'd put this, I didn't see a sub-forum that was marked "Help", although I'm notorious for overlooking obvious things. If the mods would move this post to that potentially extant topic-section, I wouldn't be mad.

5
I'm in the process of building my first dungeon, but in one room I presumed the player would be able to throw a pot across a gap to a switch. However, when I tested, I couldn't help but notice that the pot broke as soon as I threw it, as if the wall which represented the ledge was a wall in front of the hero's face. I tried a few things, but I couldn't figure out a way to get the pot over the ledge. Do y'all have any ideas?


6
Bugs & Feature requests / Re: Having Trouble with Quest simulation
« on: January 09, 2019, 06:33:59 am »
IT WORKED BOYS

Thanks much for all y'alls help  ;D

7
Bugs & Feature requests / Re: Having Trouble with Quest simulation
« on: January 09, 2019, 12:46:54 am »
Come to think of it, I did originally make this quest in 1.5 before I knew that 1.6 was out. I then got 1.6 and it automatically updated the file. Do you think that the main.lua of that quest didn't change in that update, and is now incompatible with the current version?

8
Bugs & Feature requests / Re: Having Trouble with Quest simulation
« on: January 09, 2019, 12:11:20 am »
Here's the game manager script:

-- Script that creates a game ready to be played.

-- Usage:
-- local game_manager = require("scripts/game_manager")
-- local game = game_manager:create("savegame_file_name")
-- game:start()

local game_manager = {}

local initial_game = require("scripts/initial_game")
local multi_events = require("scripts/multi_events")

-- Creates a game ready to be played.
function game_manager:create(file_name)

  local exists = sol.game.exists(file_name)
  local game = sol.game.load(file_name)
  if not exists then
    -- Initialize a new savegame.
    initial_game:initialize_new_savegame(game)
  end

  -- Function called when the player presses a key during the game.
  game:register_event("on_key_pressed", function(game, key)

    if game.customizing_command then
      -- Don't treat this input normally, it will be recorded as a new command binding
      -- by the commands menu.
      return false
    end

    local handled = false
    if game:is_pause_allowed() then  -- Keys below are menus.
      if key == game:get_value("keyboard_save") then
        if not game:is_paused() and
          not game:is_dialog_enabled() and
          game:get_life() > 0 then
        game:start_dialog("save_quit", function(answer)
          if answer == 1 then
            -- Continue.
            sol.audio.play_sound("danger")
          elseif answer == 2 then
            -- Save and quit.
            sol.audio.play_sound("danger")
            game:save()
            sol.main.reset()
          else
            -- Quit without saving.
            sol.audio.play_sound("danger")
            sol.main.reset()
          end
        end)
        handled = true
      end
      end
    end

    return handled
  end)

  -- Function called when the player presses a joypad button during the game.
  game:register_event("on_joypad_button_pressed", function(game, button)
    if game.customizing_command then
      -- Don't treat this input normally, it will be recorded as a new command binding.
      return false
    end

    local handled = false

    local joypad_action = "button " .. button
    if game:is_pause_allowed() then  -- Keys below are menus.
      if joypad_action == game:get_value("joypad_save") then
        if not game:is_paused() and
            not game:is_dialog_enabled() and
            game:get_life() > 0 then
          game:start_dialog("save_quit", function(answer)
            if answer == 2 then
              -- Continue.
              sol.audio.play_sound("danger")
            elseif answer == 3 then
              -- Save and quit.
              sol.audio.play_sound("danger")
              game:save()
              sol.main.reset()
            else
              -- Quit without saving.
              sol.audio.play_sound("danger")
              sol.main.reset()
            end
          end)
          handled = true
        end
      end
    end

    return handled
  end)

  return game
end

-- TODO the engine should have an event game:on_world_changed().
local game_meta = sol.main.get_metatable("game")
game_meta:register_event("on_map_changed", function(game)

  local map = game:get_map()
  local new_world = map:get_world()
  local previous_world = game.previous_world
  local world_changed = previous_world == nil or
      new_world == nil or
      new_world ~= previous_world
  game.previous_world = new_world
  if world_changed then
    if game.notify_world_changed ~= nil then
      game:notify_world_changed(previous_world, new_world)
    end
  end
end)

game_meta:register_event("on_game_over_started", function(game)
  -- Reset the previous world info on game-over
  -- so that notify_world_changed gets called.
  game.previous_world = nil
end)

return game_manager

---------------------------------------------------------------------------------------

It's true that in main there's a string like the one you posted, but there's no such "start_game" string in game manager.
I'm currently running the default quest that's created when one goes to file>new quest

9
Bugs & Feature requests / Re: Having Trouble with Quest simulation
« on: January 08, 2019, 07:23:38 am »
While that's the case, where should I insert then game_manager:start_game()? What prefix should I use? Function, game, game_meta, or another? Thanks much for y'alls help by the way, been a great help so far

10
Bugs & Feature requests / Re: Having Trouble with Quest simulation
« on: January 06, 2019, 10:32:16 pm »
So I inserted the line Alex recommended, and I booted. The results: I got the logo going now, but then I'm presented with the same black screen and a new error. This one reads:

>Error: In on_finished: main.lua:20: attempt to call method 'start_game' (a nil value)

The main.lua script does make mention at the beginning a similar require("scripts/game_manager) line, so that's not the problem this time. Here's copy of the script (problem line is italicized. I tried playing around with it the best I could but I didn't make any headway).

-- This is the main Lua script of your project.
-- You will probably make a title screen and then start a game.
-- See the Lua API! http://www.solarus-games.org/doc/latest

local game_manager = require("scripts/game_manager")

-- This function is called when Solarus starts.
function sol.main:on_started()

  -- Setting a language is useful to display text and dialogs.
  sol.language.set_language("en")

  local solarus_logo = require("scripts/menus/solarus_logo")

  -- Show the Solarus logo initially.
  sol.menu.start(self, solarus_logo)

  -- Start the game when the Solarus logo menu is finished.
  solarus_logo.on_finished = function()
    game_manager:start_game()
  end

end

-- Event called when the player pressed a keyboard key.
function sol.main:on_key_pressed(key, modifiers)

  local handled = false
  if key == "f5" then
    -- F5: change the video mode.
    sol.video.switch_mode()
    handled = true
  elseif key == "f11" or
    (key == "return" and (modifiers.alt or modifiers.control)) then
    -- F11 or Ctrl + return or Alt + Return: switch fullscreen.
    sol.video.set_fullscreen(not sol.video.is_fullscreen())
    handled = true
  elseif key == "f4" and modifiers.alt then
    -- Alt + F4: stop the program.
    sol.main.exit()
    handled = true
  elseif key == "escape" and sol.main.game == nil then
    -- Escape in title screens: stop the program.
    sol.main.exit()
    handled = true
  end

  return handled
end

11
Bugs & Feature requests / Having Trouble with Quest simulation
« on: January 06, 2019, 08:42:35 pm »
I've been back on Solarus ever since I saw it got updated again, but unfortunately I've not been able to get the "Run quest" function of the quest editor to run. Whenever I click "run quest", the screen merely remains blank (without presenting the solarus logo) and eventually I get the following error:

>Error: In main: scripts/game_manager.lua:103: attempt to call method 'register_event' (a nil value)

Here's the problem line:

>game_meta:register_event("on_map_changed", function(game)

However, when I go and check that particular line and cross-reference it with another line (located above line 103) that contains the method "register_event", it seems to be working just fine. Doesn't that mean that register_event has a non-nil value? For example, here's a line that makes use of register_event that does not incur an error, located above the problem line

>game:register_event("on_joypad_button_pressed", function(game, button)

Now, I know that this has "game:" instead of "game_meta:" but I changed it to "game:" and it gave me an error at that line. I'm not sure that'd make a difference either. Anyways, I probably need someone technically competent to aid me here, go ahead and comment if you need more info.

Pages: [1]