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

Pages: [1] 2 3 ... 71
1
Development / Re: how do you save a number?
« on: April 01, 2020, 12:29:04 am »
I will try to explain this with more detail:

1) Use game:set_value("win", win) to store the value of the local variable win of your script in a built-in savegame variable called "win". This does NOT save your variable in a file. This updates the value of the built-in variable "win" (which is not the local variable in your script). Only buit-in variables are saved in files, and to do that it is NECESSARY to call game:save().
2) Save your game with game:save(). In the games of the Solarus Team you will find a menu to save the game, and that menu, in its code, is calling that function. If you don't call that function in any way, your savegame built-in variables will not be saved into a file. So, please, don't skip this part.
3) When your game is restarted and your savegame is reloaded (make sure that your savegame is loaded! I don't remember where this is done or if this is automatically done), you can recover your variable with:
Code: [Select]
win = game:get_value("win") I insist that in your code above you don't need any conversion because Solarus can save strings, booleans and numbers, and your variable is a number.
4) Read the errors in the console and learn to understand them. Always fix them. Never ignore them. This is crucial. If you don't understand an error, you can ask us.
5) Please, read the API of those functions and absorb its knowledge. If you don't understand something, don't hesitate to ask. If you want to learn, you need to consult the API. We all use it all the time, and it's very well written and with many examples.

Remark: in this code you wrote
Code: [Select]
win = tonumber(game:get_value(size))the compiler is complaining that size is not a string. Since the conversion to number is not necessary, that line could be replaced with this:
Code: [Select]
win = game:get_value("size")although what you need is this:
Code: [Select]
local win = game:get_value("win")

2
Development / Re: how do you save a number?
« on: March 31, 2020, 05:03:17 pm »
Savegame values can be strings, numbers or booleans. His problem is just that he is not saving or loading the variable correctly. As I pointed above, the savegame functions get/set_value use a string in first parameter as a variable name, and he is not using a string, so he is getting an error.

3
Development / Re: how do you save a number?
« on: March 30, 2020, 07:42:09 am »
I think that error means that
Code: [Select]
win = game:get_value(win)should be replaced by
Code: [Select]
win = game:get_value("win")Note that "win" is a string and win is a variable. You need to fix all errors where the console complains, or your code won't work.

4
Development / Re: how do you save a number?
« on: March 30, 2020, 04:27:44 am »
Please, first read carefully the savegame functions in the Solarus Lua API. That's the only way you can understand what those functions do. Again, this is the link for what you need:
https://www.solarus-games.org/doc/latest/lua_api_game.html

Also, reading code from others is very useful to learn.

5
Development / Re: how do you save a number?
« on: March 30, 2020, 03:04:27 am »
You forgot to load your savegame variable. Use this:
Code: (Lua) [Select]
win = game:get_value("win")You don't need to use
Code: (Lua) [Select]
game:save()since I guess that is being done in your menus when you save your game (isn't it?).
Savegame variables are saved and loaded with the functions: "game:get/set_value", which are the ones you need to use.

(By the way, the command "game:save()" has no parameters and saves ALL savegame variables:
https://www.solarus-games.org/doc/latest/lua_api_game.html#lua_api_game_save)

Always use the Solarus Lua API when you don't know how to do something. Usually the answer is there.

6
Development / Re: how do you save a number?
« on: March 30, 2020, 01:51:18 am »
To debug, try some prints:
Code: (Lua) [Select]
print(size)
print(type(size))
If your variable is null, check if you used the saving function "game:save()" or if the savegame was really loaded when restarted.

EDIT: i don't think others can really help you if you don't post the real code of that  function.

7
Development / Re: Sprites not visible when entities created
« on: March 30, 2020, 01:37:33 am »
As mr froggy asked above,did you check that all sprite and enemy properties are correct?
Some things to check: position of the sprites in the image and of the enemy in the map, that the enemy and sprites exist, the sprites' origin point, etc. Make sure that you start an animation and that it does exist. Remember that the engine in many cases starts automatically the walking animation on enemies, and if that one does not exist you may see nothing at all (it is easy to override this built-in behavior using sprite/entity events, as I do with my enemies).

8
Your projects / Re: Long Steel
« on: February 12, 2020, 08:21:21 pm »
Awesome work! I will ask you for a link when I find some free time to play it. Thanks for sharing it.

9
Game art & music / Re: Original art
« on: October 18, 2019, 06:41:19 pm »
New chiptune again!!!
Song name: Dubious Riddle
https://youtu.be/IosW0yqaiIY

Give me some Thumbs Up to support my motivation. Thanks!

10
Game art & music / Re: Original art
« on: October 06, 2019, 12:58:24 pm »
Added new wendigo enemy to the Free-Resource-Pack.
It will also appear in our secret project Children of Solarus. :)

These are almost pacific enemies, but be careful, their fast counterattacks could be lethal.
https://youtu.be/mo8hl_jTOzA

11
Game art & music / Re: Original art
« on: October 05, 2019, 03:10:52 pm »
Another new chiptune: "Hope Scent".
https://www.youtube.com/watch?v=KIZ_SXl2SWw

12
Lol, thanks! I get it now.
I am not good at puzzles with pieces hidden below the carpet. I had even tried to move the torches and thought the puzzle was broken XD.

13
Cool, thanks!

14
Your projects / Re: Zeldo's Challenge - Chapter 1: The Revenge of the Bingo
« on: September 30, 2019, 10:58:34 pm »
@Christopho:
I got this error while playing this game. I was using an old version of Solarus: v1.6.0.
I believe this is an engine error: "Fatal: This state is already stopping: pulling" (see image below).
Was this fixed in v1.6.2? By the way, I've just downloaded the last engine version now, just in case.

@Zeldo: I'm still stuck in that puzzle. I believe I've become a casual player... :'(

15
Development / Re: Prevent attack command from attacking
« on: August 26, 2019, 03:37:30 am »
To give an adequate answer for your purposes we need to know this: do you want to always disable the sword attack in all your game? Or just temporarily under certain states/conditions?

Pages: [1] 2 3 ... 71