Joseph
-
Posts
3 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Joseph
-
-
I trying to create a gui inside the game using the template in main.lua and menu.lua, but when i try to process the user response, it seems like the Main.lua take the event off the eventqueue so i connot process the event into my script. I didn't understand the logic to put the processing routine of my gui into my script.
-
Before thinking of making a game, i'm trying to understand the multiplayer suport. I think that nowaday, a game without multiplayer is incomplete.
I understand the choice for networking using steam, but i don't want make games only for publishing on steam.
So i want to use the Client and Server classes even knowing the problems (there is no NAT punchtrough, but this can be solved with port forwarding or a VPN like radmin).
However, i can't understand this classes because the lack of documentation for the bank data type (that i plan to use for sending information of position and rotation of objects).
Can you send me the documentation of the bank data type for lua? Can i use the bankstream instead of bank on the functions of Client/Server classes?
Note: I was scripting in lua because i just have the Indie Edition
Sorry for my English
I don't know how to process GUI responses
in Programming
Posted
I solved the problem with a global variable, but i don't know if it's the right way. I'm trying to create a menu that appears when a user click door and let the user choose a place to go (that is another map). So i did it that way:
1-I created the gui using Menu.lua as template
2-i wrote a code in the updatephysics of one object called computer that verifies if the user clicks the door (using camera:pick) and then shows the menu (that select the place to go)
3-i inserted a global variable in Main.lua called eventosGUI that stores the event
while EventQueue:Peek() do
local event
event = EventQueue:Wait()
eventosGUI = event
event = gamemenu:ProcessEvent(event)
end
4-then inside the updatephysics of the computer object, i compare eventosGUI.source with the button widget and if its true, i call changemapname = "name of the map"
But there is another problem. The cancel button that i put at the end of the menu is acting strangelly:
1-The player clicks the door
2-the menu opens normally
3- the player clicks the cancel button
4-the menu closes
5-the player click the door for the second time
6-the menu just flashes
7-the player click the door for the third time
8-the menu opens normally
So i solved this ploblem with a flag called corrigeQueue initially setted to false (but i don't know if it's the right way):
if eventosGUI ~= nil then
...
if eventosGUI.source == self.mudaLocalGui.botaoCancelar then
if not self.corrigeQueue then
self.paineldegui = false
self.mouse_padrao = false
self.jogador.script.modoAndar = true
self.mudaLocalGui:Hide()
janela:HideMouse()
self.corrigeQueue = true
else
self.corrigeQueue = false
end
end
eventosGUI = nil
end
I tried to flushkeys but it doesn't solved the problem, and i put a Debug:Assert(false, tostring(eventosGUI)) before showing the menu and it returns nil, but i know that the flashing is occurring because eventosGUI ~=nil and eventosGUI.source == self.mudaLocalGui.botaoCancelar returns true