Streaming game development: https://www.twitch.tv/stabyourself Image

SE bugfixes

Mods, guides how to use and install mods go right in here.
I LÖVE LUA
User avatar
Posts: 151
Joined: 12 Aug 2013, 13:19
Reputation: 20
Contact:

Post » 18 Jun 2017, 02:25

Something that bothers me is that, when I'm on my laptop, I cant type numbers into inputs, so I went and made them use "textinput" instead of "keypressed". The list of the changes done to accomplish this is down below.

  • In main.lua:

    Code: Select all

    function love.textinput(text)
       if _G[gamestate .. "_textinput"] and type(_G[gamestate .. "_textinput"]) == "function" then
          local success, err = pcall(function() _G[gamestate .. "_textinput"](text) end) -- I don't wanna cause a crash
          if not success then print(err) end
       end

       if guielements then
          for _, v in pairs(guielements) do
             v:textinput(text)
          end
       end
    end
  • In gui.lua (Note: you need to replace keypress to avoid weird double input):

    Code: Select all

    function guielement:textinput(text)
       if self.type == "input" and self.inputting then
          local ok = true
          for i = 1, string.len(text) do
             if not fontquads[text:sub(i, i)] then
                ok = false
             end
          end
          if not ok then return end -- Can you believe this is taken from Minecraft?
          self.value = self.value .. text
          self.cursorpos = self.cursorpos + string.len(text)
       end
    end

    function guielement:keypress(key)
       if self.active then
          if self.type == "input" then
             if self.inputting then
                --[[if key == "-" or key == "," or key == ":" or key == ";" then
                   return
                end]]
                if key == "escape" then
                   self.inputting = false
                elseif (key == "return" or key == "enter" or key == "kpenter") then
                   if self.func then
                      self:func()
                   else
                      self.inputting = false
                   end
                elseif key == "backspace" then
                   self.value = string.sub(self.value, 1, string.len(self.value)-1)
                   if self.cursorpos > 1 and self.cursorpos > string.len(self.value)+1 then
                      self.cursorpos = self.cursorpos - 1
                   end
                   if self.offset > 0 and self.offset > string.len(self.value)-self.width+1 then
                      self.offset = self.offset - 1
                   end
                --[[else
                   if string.len(self.value) < self.maxlength or self.maxlength == 0 then
                      local found = false
                      for i = 1, string.len(fontglyphs) do
                         if key == string.sub(fontglyphs, i, i) then
                            found = true
                            break
                         end
                      end
                      
                      if found and (not self.numerical or tonumber(key) or key == "." or key == ",") then
                         if key == "," then
                            key = "."
                         end
                         
                         self.value = self.value .. key
                         if self.cursorpos ~= self.maxlength then
                            self.cursorpos = self.cursorpos + 1
                         end
                         if self.cursorpos > self.offset+self.width then
                            self.offset = self.offset + 1
                         end
                      end
                   end]]
                end
                
                return true
             end
          end
       end
    end
  • In game.lua:

    Code: Select all

    function game_textinput(text)
       if editormode and not testlevel then
          editor_textinput(text)
       end
    end
  • In editor.lua:

    Code: Select all

    function editor_textinput(text)
       if rightclickm then
          rightclickm:textinput(text)
       end

       if animationguilines then
          for i, v in pairs(animationguilines) do
             for k, w in pairs(v) do
                w:textinput(text)
             end
          end
       end
    end
  • In rightclickmenu.lua:

    Code: Select all

    function rightclickmenu:textinput(text)
       for i = 1, #self.t do
          if self.t[i].type then
             if self.t[i]:textinput(text) then
                return
             end
          end
       end
    end
  • And finally, in animationguiline.lua:

    Code: Select all

    function animationguiline:textinput(text)
       for i = 1, #self.elements do
          if self.elements[i].gui then
             self.elements[i].gui:textinput(text)
          end
       end
    end


I wanna point out that it is also implemented in my mod, but I figured it could be considered as a "bugfix".

Also, good luck Hugo with the contest (as I'm in too ;p).

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 18 Jun 2017, 03:37

Thanks a lot, dude! I was planning on implementing that at some point (I kept trying to type numbers using the keypad and it was frustrating me), so this came in handy at the right time! Implemented it already :)

And good luck with the contest too ;)

I LÖVE LUA
User avatar
Posts: 151
Joined: 12 Aug 2013, 13:19
Reputation: 20
Contact:

Post » 29 Jun 2017, 13:28

Just came across something weird in the editor (i did not move my mouse):


It also crashes when copying while the copy cursor (the green-ish square) is outside of the screen:
editor.lua:3719: attempt to index a nil value

Traceback

main.lua:126: in function '__index'
editor.lua:3719: in function 'getTiles'
editor.lua:3288: in function 'editor_keypressed'
editor.lua:4036: in function 'game_keypressed'
main.lua:1680: in function <main.lua:1619>
main.lua:80: in function <main.lua:26>
[C]: in funciton 'xpcall'

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 29 Jun 2017, 16:12

Yeah, I noticed these problems recently as well. I'm inclined to say it came with the port to SE, so I'll try to fix that if possible. Thanks!

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 01 Jul 2017, 19:05

Alright, I fixed the scrolling issues with Better Editor. But I have no idea why the error you reported happens, since I can't reproduce it myself. What exactly do you mean by "outside of the screen"?

Try reproducing it again, if you can, and if it still happens, please let me know how you make it happen, so I can understand it better. Thanks :)

I LÖVE LUA
User avatar
Posts: 151
Joined: 12 Aug 2013, 13:19
Reputation: 20
Contact:

Post » 01 Jul 2017, 19:07

I mean you scroll so much to the right you don't see the selection cursor when pressing control.

Edit 1: cool, it's fixed too. I was suspecting it a bit, but it looks those two errors were linked.

Edit 2: But there is another thing...
Image
Now (if it wasn't before) it's the replace_all that's not scrolling correctly.

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 01 Jul 2017, 19:35

It was an oversight from my end, should be patched now. Thanks again!

Technochips
User avatar
Posts: 691
Joined: 12 Mar 2015, 16:05
Reputation: 190
Contact:

Post » 29 Jul 2017, 17:19

On the latest version of Love2D, the game crashes when you try to change the controls. Apparently it's because it's using some functions for the joystick that was removed in 0.9.0. So I fixed this by copypasting this.


RealGabdhhf
Posts: 28
Joined: 16 Jul 2017, 21:45
Reputation: 4

Post » 29 Jul 2017, 18:34

No local multiplayer bug fixes?

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 29 Jul 2017, 22:01

Thanks, Technochips! Updated it to include your fixes :)

HansAgain
User avatar
Posts: 1135
Joined: 03 Feb 2012, 18:51
Reputation: 265
Contact:

Post » 02 Aug 2017, 00:21

Everytime i click the button to select tiles in the [i] entity menu the game crashes.
Image

EDIT: I happens when i do the same with the trigger area entity.

I LÖVE LUA
User avatar
Posts: 151
Joined: 12 Aug 2013, 13:19
Reputation: 20
Contact:

Post » 02 Aug 2017, 06:15

Replace editor.lua in the bugfix with this one. For some reason, startregion was commented out (maybe Hugo knows why).

HugoBDesigner
User avatar
Posts: 2115
Joined: 19 Sep 2012, 02:23
Reputation: 667
Contact:

Post » 02 Aug 2017, 12:22

Oops, probably my fault from when I was trying to fix the editor. Sorry about that, should be fixed now. Thanks, I LÖVE LUA :)


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 3 guests

cron