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

Pages: [1] 2 3 ... 68
Did anyone download the ALTTP outside sample maps that ffomega made?
Because they were lost and it was a lot of work. I only have two of them (Kakariko Village and Hyrule Castle).
Thanks for you help.

Development / Re: Adding WASD control in tandem with arrow keys
« on: July 29, 2017, 01:02:43 pm »
It should be simpler by using game:on_key_pressed/released and calling game:simulate_command_pressed/released() from there.

To avoid the conflict with the D key, just assign the pause command to another key than D.

Development / Re: How to use: chest:on_opened() ?
« on: July 11, 2017, 05:01:21 pm »
Your first line is not valid Lua syntax. Are you trying to define a function or to call a function?

Development / Re: In trouble with pause menu
« on: June 29, 2017, 11:45:04 pm »
It is a bug of Mercuris' Chest menus that became apparent when I introduced the multi_events.lua script. I fixed it in other games (Zelda XD2 and Zelda OLB SE) but not in Mercuris' Chest yet. But you can reproduce essentially the same fix as in Zelda XD2 here:

It is a slight inacurracy that also exists in A Link to the Past.

Development / Re: How to get the hero in an item script?
« on: June 06, 2017, 10:39:13 am »
Code: Lua
  1. --slow the hero down
  2. function item:on_map_changed(map)
  3.   local hero = map:get_hero()
  4.   hero:set_walking_speed(30)
  5. end

Bugs & Feature requests / Re: "normal" video mode is at 2x
« on: June 05, 2017, 09:22:20 am »
Then it must be a bug.

Bugs & Feature requests / Re: "normal" video mode is at 2x
« on: June 03, 2017, 07:23:01 pm »
If you call, 240), it should work.

Bugs & Feature requests / Re: "normal" video mode is at 2x
« on: June 02, 2017, 09:50:39 am »
The x2 window scaling is just the default size of the normal video mode. You can always change that by calling

Development / Re: Get all map entities?
« on: June 01, 2017, 11:24:04 pm »
Well a movement can only have one direction at a time, so you have to choose a target.
You can always make a loop to detect the closest entity from a list of entities, and repeat this in a timer.

Development / Re: Screen vs entity position?
« on: May 15, 2017, 05:08:27 pm »
entity:get_position() give coordinates relative to the map. You can find coordinates relative to the screen if you just subtract the camera position.

Development / Re: pcall metatable?
« on: May 05, 2017, 02:05:09 pm »
Ok, so your question is actually independent from metatables or Solarus, it is about the passing a value of type function vs calling a function.
Code: Lua
  1. function metatable:example()
  2.   --some code
  3. end

This defines a field "example" (of type function) on the object "metatable", and not an "example" global value.

Which means that you can call it like this, assuming you  have an entity called my_entity:
Code: Lua
  1. my_entity:example()
and not like this
Code: Lua
  1. example() -- Does not work: example is nil

If you want to make a value of type function instead of doing the call entity:example(), just wrap the call it in a function:
Code: Lua
  1. local function f()
  2.   my_entity:example()
  3. end
Then it is a value of type function (and not a function call anymore, this is the trick!) so you can pass it to anything that wants a value of type function, like pcall, sol.timer.start, etc.
Code: Lua
  1. local success = pcall(f)
  2. if success then
  3.   ...
  4. else
  5.   ...
  6. end

You can even keep it anonymous if you prefer:
Code: Lua
  1. local success = pcall(function()
  2.   entity:example()
  3. end)
  4. if success then
  5.   ...
  6. else
  7.   ...
  8. end

Development / Re: pcall metatable?
« on: May 05, 2017, 11:21:31 am »
Your code is a correct way to catch errors.
But you were talking about metatables in your first message, what do you want to know exactly?

I don't know if it answers your question, but sol.main.get_metatable() returns nil if the parameter is an unknown type name. It will only throw an error if the parameter is missing or is not a string.

Development / Re: pcall metatable?
« on: May 05, 2017, 10:01:00 am »
What do you mean?

Development / Re: 2 Player
« on: May 02, 2017, 10:32:01 am »
For networking multiplayer, you don't need to change the C++ code of the engine. You can use a Lua networking library like LuaSocket. It is true that there is no direct networking support in the Solarus API yet: you will have to do a lot of things manually, but no C++.

Pages: [1] 2 3 ... 68