Post your modding questions here

User avatar
rubenwardy
Moderator
 
Posts: 5891
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

Re: Post your modding questions here

by Evergreen » Tue Jan 12, 2016 19:41

Solved, see last post.
Back from the dead!
 

User avatar
BrunoMine
Member
 
Posts: 1063
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: how can I delete a variable?

by BrunoMine » Wed Jan 13, 2016 00:43

qwertymine3 wrote:This is faster, but messes up the order of the table

but if it is not an ordinary 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)

This saves no memory?
 

User avatar
qwertymine3
Member
 
Posts: 202
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: how can I delete a variable?

by qwertymine3 » Wed Jan 13, 2016 03:21

BrunoMine wrote:but if it is not an ordinary 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)

This saves no memory?


I would recommend reading this http://www.lua.org/gems/sample.pdf - this is my main reference for lua specific optimisations

+ My Attempt at an Answer
Avatar by :devnko-ennekappao:
 

User avatar
Merlin
Member
 
Posts: 63
Joined: Tue Dec 09, 2014 22:07
Location: germany
GitHub: sct-0
In-game: my

Re: Post your modding questions here

by Merlin » Wed Jan 13, 2016 11:36

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/showthread.php?390252-How-to-make-these-x-files-look-alike with all important files attached.
As no one yet answered there, I thought I'd try my luck here.

Thanks in advance!
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Wed Jan 13, 2016 12:07

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/showthread.php?390252-How-to-make-these-x-files-look-alike with all important files attached.
As no one yet answered there, I thought I'd try my luck here.

Thanks in advance!

Did you have checked out the Export animation field before your exportation?
And did you have selected all objects of your model?
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
Merlin
Member
 
Posts: 63
Joined: Tue Dec 09, 2014 22:07
Location: germany
GitHub: sct-0
In-game: my

Re: Post your modding questions here

by Merlin » Wed Jan 13, 2016 12:23

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.
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Wed Jan 13, 2016 13:38

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?
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
Hybrid Dog
Member
 
Posts: 2719
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Wed Jan 13, 2016 16:53

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?

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

Byakuren
Member
 
Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Thu Jan 14, 2016 00:27

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.
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ

Re: Post your modding questions here

by ABJ » Fri Jan 15, 2016 09:23

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?
 

User avatar
BrunoMine
Member
 
Posts: 1063
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

difference of teleport?

by BrunoMine » Sun Jan 17, 2016 17:45

Code: Select all
player:setpos(pos)

player:moveto(pos)

These two perform exactly the same task?
What is the difference?
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Jan 17, 2016 19:53

setpos -> teleport/magic
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):
 

User avatar
BrunoMine
Member
 
Posts: 1063
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Sun Jan 17, 2016 20:03

In 'moveto' the player is teleported.
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Jan 17, 2016 20:28

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...
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
BrunoMine
Member
 
Posts: 1063
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: Post your modding questions here

by BrunoMine » Sun Jan 17, 2016 21:24

iangp wrote:check out this option "continuous" (turn it true and after that false) and see what happens with the player...

I did not realize the difference.
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Jan 17, 2016 23:16

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 wanted this for my starwars mod] 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):
 

User avatar
rubenwardy
Moderator
 
Posts: 5891
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Jan 17, 2016 23:29

I'm getting the same... I think this should be reported as an issue...
@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):
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Sun Jan 17, 2016 23:30

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.

yes yes :D sorry about that...
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
Hybrid Dog
Member
 
Posts: 2719
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Mon Jan 18, 2016 18:54

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

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Mon Jan 18, 2016 19:06

@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...
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

User avatar
rubenwardy
Moderator
 
Posts: 5891
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Mon Jan 18, 2016 19:17

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


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:

Image

^--- note the player starts here, at the bottom left.
 

User avatar
iangp
Member
 
Posts: 114
Joined: Sat May 31, 2014 19:26
Location: Brasil - ES
GitHub: 14NGiestas
IRC: iangp
In-game: iangp

Re: Post your modding questions here

by iangp » Mon Jan 18, 2016 20:36

When a player walks, you don't want them to suddenly disappear then reappear in a new place, you want the to slide across.

Of course
It's for interpolation, to minimise the appearence of lag.

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...
Right?
God's not dead, He's surely alive!
エル プサイ コングルー

My mods (WIP):
 

OmniStudent
Member
 
Posts: 261
Joined: Sat Nov 03, 2012 06:40

Re: Post your modding questions here

by OmniStudent » Tue Jan 19, 2016 04:52

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.
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 3 guests