Post your modding questions here
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Post your modding questions here
Try print(dump(inv:get_lists()))?
- Evergreen
- Member
- Posts: 2135
- Joined: Sun Jan 06, 2013 01:22
- GitHub: 4Evergreen4
- IRC: EvergreenTree
- In-game: Evergreen
- Location: A forest in the midwest
- Contact:
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: how can I delete a variable?
but if it is not an ordinary table?qwertymine3 wrote:This is faster, but messes up the order of the table
For example:
Code: Select all
database = {}
-- Keeps a value when the player connect
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
database[name] = {<data_of_mod>}
end)
-- Remove the value when the player leaves
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
database[name] = nil
end)
- qwertymine3
- Member
- Posts: 202
- Joined: Wed Jun 03, 2015 14:33
- GitHub: Qwertymine
- In-game: qwertymine3
Re: how can I delete a variable?
I would recommend reading this http://www.lua.org/gems/sample.pdf - this is my main reference for lua specific optimisationsBrunoMine wrote: but if it is not an ordinary table?
For example:This saves no memory?Code: Select all
database = {} -- Keeps a value when the player connect minetest.register_on_joinplayer(function(player) local name = player:get_player_name() database[name] = {<data_of_mod>} end) -- Remove the value when the player leaves minetest.register_on_leaveplayer(function(player) local name = player:get_player_name() database[name] = nil end)
Spoiler
That should save memory as the {<data_of_mod>} can now be removed from memory.
If {<data_of_mod>} contained a string stored else where, that string will not be removed from memory - but the rest of the table will be.
The database[] table will not get smaller in memory though i.e. if it had 2 people and you removed one, it would still have 2 'slots' of memory reserved to be able to put a person in
Overall:
If {<data_of_mod>} contained a string stored else where, that string will not be removed from memory - but the rest of the table will be.
The database[] table will not get smaller in memory though i.e. if it had 2 people and you removed one, it would still have 2 'slots' of memory reserved to be able to put a person in
Overall:
Code: Select all
local annoying_extra_string = "stored string"
local constant = 5
local do_generic_stuff Longer= function() return nil; end
database = { --this table will have enough 'slots' to store the largest no. people you had in it (and a few extra)
template = {
string_one = "stored_string", --this string is stored by annoying_extra_string - when the table is deleted only the
--memory used for the 'slot' will be saved
string_two = "unique_string", --this is unique - when the table is deleted both the memory for the string and slot
--will be saved
--What I think would happen with numbers and functions - These are educated guesses however
number = 5, --when the table is deleted I think any memory used by this can be freed
another_number = constant, --same as above
do_stuff = function() return nil; end, --when the table is deleted I assume that all the memory can be
-- freed
do_more_stuff = do_generic_stuff -- when the table is deleted I assume that only memory from the
-- 'slot' is saved as the function is still stored by do_generic_stuff
},
}
Avatar by :devnko-ennekappao:
Re: Post your modding questions here
Hi,
I've run into a problem when exporting DirectX files for mobs.
I tried to create a .x file like the ones PilzAdam uses in his SimpleMobs-Mod, but my .x just doesn't look like his and I am rather new to all that stuff and have no idea why.
I posted the whole story over here http://blenderartists.org/forum/showthr ... look-alike with all important files attached.
As no one yet answered there, I thought I'd try my luck here.
Thanks in advance!
I've run into a problem when exporting DirectX files for mobs.
I tried to create a .x file like the ones PilzAdam uses in his SimpleMobs-Mod, but my .x just doesn't look like his and I am rather new to all that stuff and have no idea why.
I posted the whole story over here http://blenderartists.org/forum/showthr ... look-alike with all important files attached.
As no one yet answered there, I thought I'd try my luck here.
Thanks in advance!
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
Did you have checked out the Export animation field before your exportation?Merlin wrote:Hi,
I've run into a problem when exporting DirectX files for mobs.
I tried to create a .x file like the ones PilzAdam uses in his SimpleMobs-Mod, but my .x just doesn't look like his and I am rather new to all that stuff and have no idea why.
I posted the whole story over here http://blenderartists.org/forum/showthr ... look-alike with all important files attached.
As no one yet answered there, I thought I'd try my luck here.
Thanks in advance!
And did you have selected all objects of your model?
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
Re: Post your modding questions here
Yes and yes. I did an export with all options checked. It's more about the structure of the files. There are differences in the .blend files which are responsible for the differences of the .x files I guess, but as total noob, I'm unable to spot them.
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
hmmm probably is because you have checked all options... (PilzAdam, maybe, only checked out some of them) and so that's can be the difference... got it?
but, why do you want this? planning some script for create .x files from zero in lua? or is a problem in-game?
but, why do you want this? planning some script for create .x files from zero in lua? or is a problem in-game?
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
For calculating those nether trees, would it work faster or slower if l used minetest.hash_node_position instead of the functions from vector.extras?
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
How is set_attach's rotation argument supposed to be formatted? Is it rotation per axis?
Every time a mod API is left undocumented, a koala dies.
-
- Member
- Posts: 3015
- Joined: Sun Jan 18, 2015 13:02
- GitHub: ABJ-MV
- In-game: ABJ
- Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
Re: Post your modding questions here
I am trying to do this.
Say I have a craft recipe that crafts 9 item1 when 1 item2 is placed in grid. Now I want to make a function that, when called, automatically creates a reverse recipe where 9 item1 goes into 1 grid each to create 1 item2. Anyone have any ideas?
Say I have a craft recipe that crafts 9 item1 when 1 item2 is placed in grid. Now I want to make a function that, when called, automatically creates a reverse recipe where 9 item1 goes into 1 grid each to create 1 item2. Anyone have any ideas?
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
difference of teleport?
Code: Select all
player:setpos(pos)
player:moveto(pos)
What is the difference?
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
setpos -> teleport/magic
moveto -> the player will walk from where he are to this point "pos"
(But I haven't tested this yet)
moveto -> the player will walk from where he are to this point "pos"
(But I haven't tested this yet)
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your modding questions here
In 'moveto' the player is teleported.
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
our savior archive: lua_api.txt
* `setpos(pos)`; `pos`=`{x=num, y=num, z=num}`
* `moveto(pos, continuous=false)`: interpolated move
check out this option "continuous" (turn it true and after that false) and see what happens with the player...
I really don't know why moveto are, by default, the same as setpos...
* `setpos(pos)`; `pos`=`{x=num, y=num, z=num}`
* `moveto(pos, continuous=false)`: interpolated move
check out this option "continuous" (turn it true and after that false) and see what happens with the player...
I really don't know why moveto are, by default, the same as setpos...
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
Re: Post your modding questions here
I did not realize the difference.iangp wrote: check out this option "continuous" (turn it true and after that false) and see what happens with the player...
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
that's a strange issue... I will finally make some simple script to test this (how do you implemented that?)
Are your minetest version the 0.4.13 one?
Well that can be a too new function... In rubenwardy's documentation (read it as: "nicer formatted version of lua_api.txt, the documentation that came with minetest.") there's a callback called on_secondary_use
that are called when the player left-click pointing to air (nothing) I tried and didn't worked... but I just downloaded the latest github code of minetes and then it worked...
Your situation can be similar to mine...
Are your minetest version the 0.4.13 one?
Well that can be a too new function... In rubenwardy's documentation (read it as: "nicer formatted version of lua_api.txt, the documentation that came with minetest.") there's a callback called on_secondary_use
that are called when the player left-click pointing to air (nothing) I tried and didn't worked... but I just downloaded the latest github code of minetes and then it worked...
Your situation can be similar to mine...
Last edited by iangp on Sun Jan 17, 2016 23:33, edited 2 times in total.
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Post your modding questions here
It's not my documentation you're refering to.
The page on my website is just a nicer formatted version of lua_api.txt, the documentation that came with minetest.
The page on my website is just a nicer formatted version of lua_api.txt, the documentation that came with minetest.
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
I'm getting the same... I think this should be reported as an issue...
@rubenwardy do you know something about that?
@rubenwardy do you know something about that?
Last edited by iangp on Sun Jan 17, 2016 23:32, edited 1 time in total.
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
yes yes :D sorry about that...rubenwardy wrote:It's not my documentation you're refering to.
The page on my website is just a nicer formatted version of lua_api.txt, the documentation that came with minetest.
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- Hybrid Dog
- Member
- Posts: 2834
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
moveto makes it look like object is grabbed and put to pos very fast, whereas
setpos makes it look like object is suddenly at pos
setpos makes it look like object is suddenly at pos
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
@Hybrid Dog
it would be cool if this function uses "velocity" as a parameter ...
because this way there's no real reason for use that function... I can't see one...
it would be cool if this function uses "velocity" as a parameter ...
because this way there's no real reason for use that function... I can't see one...
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: Post your modding questions here
It's for interpolation, to minimise the appearence of lag. When a player walks, you don't want them to suddenly disappear then reappear in a new place, you want the to slide across. Velocity results in extrapolation, if the player is moving/turning fast then it will be unpredictable, so you'd end up with this:iangp wrote:@Hybrid Dog
it would be cool if this function uses "velocity" as a parameter ...
because this way there's no real reason for use that function... I can't see one...
^--- note the player starts here, at the bottom left.
- iangp
- Member
- Posts: 114
- Joined: Sat May 31, 2014 19:26
- GitHub: 14NGiestas
- IRC: iangp
- In-game: iangp
- Location: Brasil - ES
Re: Post your modding questions here
Of courseWhen a player walks, you don't want them to suddenly disappear then reappear in a new place, you want the to slide across.
it's for: given a set of positions, if you want the player run through these points... you should use this function to the path seems more smooth...It's for interpolation, to minimise the appearence of lag.
Right?
God's not dead, He's surely alive!
エル プサイ コングルー
My mods (WIP):
エル プサイ コングルー
My mods (WIP):
- Time Travel: viewtopic.php?f=9&t=13672
- Star wars: viewtopic.php?f=9&t=10086
- Pythonic speaker: viewtopic.php?f=9&t=13381
-
- Member
- Posts: 261
- Joined: Sat Nov 03, 2012 06:40
Re: Post your modding questions here
Hello! Can anyone help me with this?
Topic: Need example code that "locks" doors when an object is rightpunched.
Reason: I want to make an "airlock" for entering dungeons.
More Info: I've only done the initial lua tutorial yet, but I am savvy in other languages.
Topic: Need example code that "locks" doors when an object is rightpunched.
Reason: I want to make an "airlock" for entering dungeons.
More Info: I've only done the initial lua tutorial yet, but I am savvy in other languages.
Who is online
Users browsing this forum: Google [Bot] and 8 guests