Using Pointers Causes the Game to Crash

Description: Archive discussion
============================
Original description:
Official subforum for LunaLua - an extension framework for SMBX Engine Version 1.3 (which a core of SMBX 2.0). Share your creations that require the use of LunaLUA. You may also share info/tutorials on how to use LunaLUA.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 3 May 2015, 2:03

I was finally able to locate the pointer for screen width in SMBX, but I attempted to use it and SMBX crashed. There was no error message; the program simply froze and the "This program has stopped working. Windows is trying to find a solution to the problem." Window popped up. Here is the offending code:

Code: Select all

if mem(mem(0x00CB3C28, FIELD_BYTE) + 48, FIELD_DWORD) == 400 then
         _G["split_screen_offset"] = 170
      else
         _G["split_screen_offset"] = 0
      end

The field type of the pointer is 4-Byte. I don't know if I put the right field type there, but it seemed like the right one.
I also tried with "FIELD_WORD." That didn't work either.
I know this is the part of my code with the problem because it is only executed in 2P mode, and SMBX only crashes when I attempt a 2P test.
Here's the pointer information:
Screen Width Pointer.PNG
Screen Width Pointer.PNG (9.93 KiB) Viewed 1742 times
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #2by Kevsoft » 3 May 2015, 7:55

Where did you get the address 0x00CB3C28? Also why do you use FIELD_BYTE for getting a pointer?
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 5 May 2015, 3:58

Kevsoft wrote:Where did you get the address 0x00CB3C28?

I found the address for screen width and write traced it. The pointer I found works in Cheat Engine.
Kevsoft wrote:Also why do you use FIELD_BYTE for getting a pointer?
What field type should it be? I tried BYTE, WORD, and DWORD. They all caused it to crash
edit
The code seems to work by itself, but if I run it in addition to all my other code, it crashes SMBX. Do you think I might be telling it to do too much at once?
Here is the whole script:
Spoiler

Code: Select all

--Custom HUD
--Coded by Sambo
--User Data
_G["saveData"] = Data(Data.DATA_WORLD, "Save", true)
--npc counter
function countNPCID(id)
   local npcs = findnpcs(id, -1)
   local count = 0
   for k,v in pairs(npcs) do
      count = count + 1
   end
   return count
end
_G ["save"] = function()
   saveData:set("coins", coins.. "")
   saveData:set("DCoins", DCoins .. "")
   saveData:save()
end
function onEvent(eventName)
   if runTest ~= eventName then
      runTest = eventName
      if split_route == false then
         if eventName == "dc-trig-1" then
            _G["saveData"]:set(level_code .. "-dc-1", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 7, 472 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-2" then
            _G["saveData"]:set(level_code .. "-dc-2", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 7, 484 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 7, 496 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-4" then
            _G["saveData"]:set(level_code .. "-dc-4", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 7, 508 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-5" then
            _G["saveData"]:set(level_code .. "-dc-5", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 7, 520 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         end
      elseif split_route == true then
         if eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 534 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 546 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 558 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 570 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 582 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 520 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 508 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 496 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 484 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         elseif eventName == "dc-trig-3" then
            _G["saveData"]:set(level_code .. "-dc-3", "collected")
            DCoins = DCoins + 1
            placeSprite(1, 2, 472 - split_screen_offset, 72)
            triggerEvent("dc-trig-hide")
         end
      end
   end
end
function onLoad()
   loadImage ("../HUD/hud.bmp", 1, 0xdc00ff);
   loadImage("../HUD/starslot.bmp", 5, 0xdc00ff);
   level_cleared = 0 -- Set to 1 if the level has been cleared
   checkpoint = 0 -- Set to 1 if the checkpoint has been reached
   HUD_loaded = nil --Controls HUD loading and reloading
   runTest = ""
   coin_switch = 0 --Set to 1 if collected Dragon Coins have been turned gray
--Get number of Dragon Coins
   _G["DCoins"] = _G["saveData"]:get("DCoins")
   if(DCoins == "") then
      _G["DCoins"] = 0
   else
      _G["DCoins"] = tonumber(DCoins)
   end
  --Hide default HUD
   hud(false)
   coins = _G["saveData"]:get("coins")
   if(coins == "") then
      coins = 0
   else
      coins = tonumber(coins)
   end
end
function onLoop()
--Coin collection algorithm
   if mem(0x00b2c5a8, FIELD_WORD) ~= 0 then
      oneUp = oneUp + mem(0x00b2c5a8, FIELD_WORD)
      coins = coins + mem(0x00b2c5a8, FIELD_WORD)
      mem(0x00b2c5a8, FIELD_WORD, 0)
   end
--Coin counter
   printText(coins.. "", 514, 14)
--1up management
   if oneUp == nil then -- "# Comparison to nil value" bugfix
      oneUp = 0
   end
   if oneUp >= 100 then
      mem(0x00b2c5ac, FIELD_FLOAT, mem(0x00b2c5ac, FIELD_FLOAT) + 1) --Give the player a 1up
      playSFX(15) -- Play 1up SFX
      oneUp = oneUp - 100 -- reset counter
   end
--Save userdata if checkpoint is reached
   local checkpoint_count = countNPCID(192)
   if checkpoint_count == 0 and checkpoint == 0 then
      save()
      checkpoint = 1
   end
--Save userdata if level is completed
   if winState() ~= 0 and level_cleared == 0 then
      save()
      level_cleared = 1
   end
--Player Checks
--Offset control for P1's Reserve Box
   if (player2 ~= nil) then
      reserve_offset_x = 20
      reserve_offset_y = 4
      triggerEvent("2P Item Mode")
      --Offset control for split-screen mode (Let's try with a pointer)
      if mem(mem(0x00CB3C28, FIELD_WORD) + 48, FIELD_DWORD) == 400 then
         split_screen_offset = 170
      else
         split_screen_offset = 0
      end
   else
      reserve_offset_x = 0
      reserve_offset_y = 0
      split_screen_offset = 0
--      if player2 ~= nil then -- [TEMPORARY], remove after code has been fixed
--         triggerEvent("2P Item Mode")
--      end --[/TEMPORARY], remove after code has been fixed
   end
--Life counter
   printText(mem(0x00b2c5ac, FIELD_FLOAT).. "", 292 - split_screen_offset, 14)
--Star counter
   printText(mem(0x00b251e0, FIELD_DWORD).. "", 292 - split_screen_offset, 44)
--Dragon Coin counter
   printText(DCoins .. "", 514 - split_screen_offset, 44)
--Reserve Box (player 1)
   if reserve ~= player:mem(0x158, FIELD_WORD) then
      reserve = player:mem(0x158, FIELD_WORD)
      if reserve == 0 then
         loadImage("NONE", 3, 0xdc00ff)
      elseif reserve == 184 then
         loadImage("../HUD/smb_shroom.bmp", 3, 0xdc00ff)
      elseif reserve == 182 then
         loadImage("../HUD/smb_flower.bmp", 3, 0xdc00ff)
      elseif reserve == 9 then
         loadImage("../HUD/smb3_shroom.bmp", 3, 0xdc00ff)
      elseif reserve == 14 then
         loadImage("../HUD/smb3_flower.bmp", 3, 0xdc00ff)
      elseif reserve == 34 then
         loadImage("../HUD/leaf.bmp", 3, 0xdc00ff)
      elseif reserve == 264 then
         loadImage("../HUD/smb3_iceflower.bmp", 3, 0xdc00ff)
      elseif reserve == 169 then
         loadImage("../HUD/tanooki_suit.bmp", 3, 0xdc00ff)
      elseif reserve == 170 then
         loadImage("../HUD/hammer_suit.bmp", 3, 0xdc00ff)
      elseif reserve == 248 then
         loadImage("../HUD/stopwatch.bmp", 3, 0xdc00ff)
      elseif reserve == 185 then
         loadImage("../HUD/smw_shroom.bmp", 3, 0xdc00ff)
      elseif reserve == 183 then
         loadImage("../HUD/smw_flower.bmp", 3, 0xdc00ff)
      elseif reserve == 277 then
         loadImage("../HUD/smw_iceflower.bmp", 3, 0xdc00ff)
      end
      placeSprite(1, 3, 384 - reserve_offset_x - split_screen_offset, 30 - reserve_offset_y)
   end
--Reserve Box (player 2)
   if (player2 ~= nil) then
      if reserve2 ~= player2:mem(0x158, FIELD_WORD) then
         reserve2 = player2:mem(0x158, FIELD_WORD)
         if reserve2 == 0 then
            loadImage("NONE", 4, 0xdc00ff)
         elseif reserve2 == 184 then
            loadImage("../HUD/smb_shroom.bmp", 4, 0xdc00ff)
         elseif reserve2 == 182 then
            loadImage("../HUD/smb_flower.bmp", 4, 0xdc00ff)
         elseif reserve == 9 then
            loadImage("../HUD/smb3_shroom.bmp", 4, 0xdc00ff)
         elseif reserve2 == 14 then
            loadImage("../HUD/smb3_flower.bmp", 4, 0xdc00ff)
         elseif reserve2 == 34 then
            loadImage("../HUD/leaf.bmp", 4, 0xdc00ff)
         elseif reserve2 == 264 then
            loadImage("../HUD/smb3_iceflower.bmp", 4, 0xdc00ff)
         elseif reserve2 == 169 then
            loadImage("../HUD/tanooki_suit.bmp", 4, 0xdc00ff)
         elseif reserve2 == 170 then
            loadImage("../HUD/hammer_suit.bmp", 4, 0xdc00ff)
         elseif reserve2 == 248 then
            loadImage("../HUD/stopwatch.bmp", 4, 0xdc00ff)
         elseif reserve2 == 185 then
            loadImage("../HUD/smw_shroom.bmp", 4, 0xdc00ff)
         elseif reserve2 == 183 then
            loadImage("../HUD/smw_flower.bmp", 4, 0xdc00ff)
         elseif reserve2 == 277 then
            loadImage("../HUD/smw_iceflower.bmp", 4, 0xdc00ff)
         end
         placeSprite(1, 4, 406 - split_screen_offset, 26)
      end
   end
--HUD loader (loads the HUD in a different postion if the screen splits)
   if (HUD_loaded ~= reserve_offset_x + split_screen_offset) then
      HUD_loaded = reserve_offset_x + split_screen_offset
      reserve, reserve2 = nil, nil
      _G["dc-ind-change"] = 1
     --Load custom HUD
      placeSprite (1, 1, 174 - split_screen_offset, 10)
   --Load reserve box
      if (player2 ~= nil) then
         loadImage ("../HUD/2P_reserve.bmp", 2, 0xdc00ff)
         placeSprite (1, 2, 352 - split_screen_offset, 10)
      else
         loadImage ("../HUD/1P_reserve.bmp", 2, 0xdc00ff)
         placeSprite (1, 2, 364, 10)
      end
   --Load indicator image
      loadImage("../HUD/ind.bmp", 7, 0xdc00ff)
   --Show obtained dragon coins; replace collected with gray dragon coin
      if coin_switch == 0 then
         if split_route == false then
            if(saveData:get(level_code .. "-dc-1") == "collected") then
               placeSprite(1, 7, 472, 72)
               triggerEvent("dcc-1")
            end
            if(saveData:get(level_code .. "-dc-2") == "collected") then
               placeSprite(1, 7, 484, 72)
               triggerEvent("dcc-2")
            end
            if(saveData:get(level_code .. "-dc-3") == "collected") then
               placeSprite(1, 7, 496, 72)
               triggerEvent("dcc-3")
            end
            if(saveData:get(level_code .. "-dc-4") == "collected") then
               placeSprite(1, 7, 508, 72)
               triggerEvent("dcc-4")
            end
            if(saveData:get(level_code .. "-dc-5") == "collected") then
               placeSprite(1, 7, 520, 72)
               triggerEvent("dcc-5")
            end
            coin_switch = 1
         else
            if (saveData:get(level_code .. "-dc-1") == "collected") then
               placeSprite(1, 2, 534, 72)
               triggerEvent("dcc-1")
            end
            if (saveData:get(level_code .. "-dc-2") == "collected") then
               placeSprite(1, 2, 546, 72)
               triggerEvent("dcc-2")
            end
            if (saveData:get(level_code .. "-dc-3") == "collected") then
               placeSprite(1, 2, 558, 72)
               triggerEvent("dcc-3")
            end
            if (saveData:get(level_code .. "-dc-4") == "collected") then
               placeSprite(1, 2, 570, 72)
               triggerEvent("dcc-4")
            end
            if (saveData:get(level_code .. "-dc-5") == "collected") then
               placeSprite(1, 2, 582, 72)
               triggerEvent("dcc-5")
            end
            if (saveData:get(level_code .. "-dc-L1") == "collected") then
               placeSprite(1, 2, 520, 72)
               triggerEvent("dcc-L1")
            end
            if (saveData:get(level_code .. "-dc-L2") == "collected") then
               placeSprite(1, 2, 508, 72)
               triggerEvent("dcc-L2")
            end
            if (saveData:get(level_code .. "-dc-L3") == "collected") then
               placeSprite(1, 2, 496, 72)
               triggerEvent("dcc-L3")
            end
            if (saveData:get(level_code .. "-dc-L4") == "collected") then
               placeSprite(1, 2, 484, 72)
               triggerEvent("dcc-L4")
            end
            if (saveData:get(level_code .. "-dc-L5") == "collected") then
               placeSprite(1, 2, 472, 72)
               triggerEvent("dcc-L5")
            end
         end
         coin_switch = 1
      end
   --Show orbs that have been obtained
      local orb = _G["saveData"]:get("orb_lb")
      if(orb == "collected") then
         loadImage ("../HUD/orb_lb.bmp", 6, 0xdc00ff)
         placeSprite (1, 8, 186 - split_screen_offset, 10)
      end
      orb = _G["saveData"]:get("orb_p")
      if(orb == "collected") then
         loadImage ("../HUD/orb_p.bmp", 7, 0xdc00ff)
         placeSprite (1, 9, 210 - split_screen_offset, 10)
      end
      orb = _G["saveData"]:get("orb_g")
      if(orb == "collected") then
         loadImage ("../HUD/orb_g.bmp", 8, 0xdc00ff)
         placeSprite (1, 10, 174 - split_screen_offset, 32)
      end
      orb = _G["saveData"]:get("orb_w")
      if(orb == "collected") then
         loadImage ("../HUD/orb_w.bmp", 9, 0xdc00ff)
         placeSprite (1, 11, 198 - split_screen_offset, 32)
      end
      orb = _G["saveData"]:get("orb_r")
      if(orb == "collected") then
         loadImage ("../HUD/orb_r.bmp", 10, 0xdc00ff)
         placeSprite (1, 12, 222 - split_screen_offset, 32)
      end
      orb = _G["saveData"]:get("orb_y")
      if(orb == "collected") then
         loadImage ("../HUD/orb_y.bmp", 11, 0xdc00ff)
         placeSprite (1, 13, 186 - split_screen_offset, 54)
      end
      orb = _G["saveData"]:get("orb_w")
      if(orb == "collected") then
         loadImage ("../HUD/orb_db.bmp", 12, 0xdc00ff)
         placeSprite (1, 14, 210 - split_screen_offset, 54)
      end
   end
end
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #4by Kevsoft » 5 May 2015, 12:53

Well, the address 0x00CB3C28 is dynamic. The ones which are static mostly begin with "0x00b2####". So you have to find where you get the address.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #5by Sambo » 8 May 2015, 4:35

Kevsoft wrote:Well, the address 0x00CB3C28 is dynamic. The ones which are static mostly begin with "0x00b2####". So you have to find where you get the address.
I don't think this one's dynamic, because it always points to the screen width address, but I will try to trace an address that starts with "0x00b2####"
EDIT:
I found a static address. However, replacing the dynamic address with this one did not fix the problem. SMBX still crashes the same way as before.
The correct address was 0x00b25124. You can see that number in my "Change Address" window snip, on the bottom left. Is there anything you can see wrong with this code? It seems fine to me.

Code: Select all

if mem(mem(0x00b25124, FIELD_WORD) + 48, FIELD_DWORD) == 400 then
         split_screen_offset = 170
      else
         split_screen_offset = 0
      end
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #6by Kevsoft » 8 May 2015, 16:36

Yea there is:
instead of:

Code: Select all

mem(0x00b25124, FIELD_WORD)

you need

Code: Select all

mem(0x00b25124, FIELD_DWORD)


As already mentioned: Getting a pointer of a pointer requires DWORD
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #7by Sambo » 9 May 2015, 1:54

Well, it doesn't cause the game to crash now, but it always returns 0, which means I inputted the wrong data. I'll walk you through what I did to get the pointer so you can see if I did something wrong. You found a pointer, so I assume you will understand all this.
First, I found the address of the screen width. The address was 0x00d13c20. Then I clicked "find what accesses this address" and got this:
Capture2.PNG

I chose the second result (It doesn't matter which one I picked, as they all had the same pointer value) and got this information:
Capture3.PNG

As you can see, the operation was [edx+ecx+10] and ecx = 38, so the offset for the pointer should be 48.
The pointer value was 0x00d13c20, so I ran a search for this value as a 4-Byte hex value. The address containing this value was 0x00b25124, so I created a new address as a pointer, using 0x00b25124 as the address and 48 as the offset. This pointed Cheat Engine to the address I originally found:
Capture.PNG
Capture.PNG (16.64 KiB) Viewed 1703 times

Then I closed and reopened SMBX and the pointer was still working in Cheat Engine.
From this information, I created the code, but it wasn't working, so I used the printText function to show the value of the pointed to address, and it was returning 0 for the whole level test. I also printed the value of the pointer address and it wasn't in hex. Is that a problem?

EDIT:
I just tried to directly input the address that contains the screen width. My printText code still returned 0 for that address. In Cheat Engine the value is always 400 or 800. No matter what field type I use, it still returns 0 in SMBX. How does this even work? Every other address accessed in my script is read properly.
Image
Current Project:
Image

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #8by Sambo » 12 May 2015, 4:13

It looks like my problem was that field type was supposed to be DFLOAT. It finally works!

Now that I've figured this bit out, I have run into another very minor problem. When the HUD moves, the old one stays there. I know I can fix it by loading nothing into every slot and then reloading, but this can be an annoying process. Is there a command I can use to just REMOVE all placed sprites without reloading everything?
EDIT:
Loading nothing into each image slot doesn't make the old placed sprites go away. That's really odd. Isn't it supposed to?

Additionally, the printText function only works on P1's screen. I know that it would just be both screens showing the same information anyway, but it looks broken.
Image
Current Project:
Image

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #9by Kevsoft » 12 May 2015, 7:37

Well, there will be a new render class in the next version, because Rednaxela is currently working on the new OpenGL renderer. For the printText bug I have to investigate.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

HenryRichard M
Citizen
Citizen
HenryRichard M
Citizen
Citizen
Reputation: 0
Posts: 9
Joined: 23 May 2015

Post #10by HenryRichard » 23 May 2015, 0:33

Sambo wrote:It looks like my problem was that field type was supposed to be DFLOAT. It finally works!

Now that I've figured this bit out, I have run into another very minor problem. When the HUD moves, the old one stays there. I know I can fix it by loading nothing into every slot and then reloading, but this can be an annoying process. Is there a command I can use to just REMOVE all placed sprites without reloading everything?
EDIT:
Loading nothing into each image slot doesn't make the old placed sprites go away. That's really odd. Isn't it supposed to?

Additionally, the printText function only works on P1's screen. I know that it would just be both screens showing the same information anyway, but it looks broken.

Try calling this in onLoop() and change it whenever you need to:

Code: Select all

placeSprite(1,1,0,0,"",3);

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #11by Kevsoft » 23 May 2015, 8:33

HenryRichard wrote:Try calling this in onLoop() and change it whenever you need to
No! placeSprite should only be called once.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #12by Sambo » 24 May 2015, 4:48

Kevsoft wrote:
HenryRichard wrote:Try calling this in onLoop() and change it whenever you need to
No! placeSprite should only be called once.
@HenryRichard: You just asked me for help with a custom HUD not too long ago and I told you that the placeSprite command should only be called once.
Image
Current Project:
Image

HenryRichard M
Citizen
Citizen
HenryRichard M
Citizen
Citizen
Reputation: 0
Posts: 9
Joined: 23 May 2015

Post #13by HenryRichard » 31 May 2015, 1:17

Sambo wrote:
Kevsoft wrote:
HenryRichard wrote:Try calling this in onLoop() and change it whenever you need to
No! placeSprite should only be called once.
@HenryRichard: You just asked me for help with a custom HUD not too long ago and I told you that the placeSprite command should only be called once.
this code only shows it for a few frames, so it won't cause 39258195215123 sprites in the level after some time.

Kevsoft M
Angry developer
Angry developer
Avatar
Kevsoft M
Angry developer
Angry developer
Age: 24
Reputation: 93
Posts: 379
Joined: 26 Apr 2014
Location: Austria
Website

Post #14by Kevsoft » 31 May 2015, 7:53

placeSprite draws the sprite forever.
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.start() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬ Signature.end() ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬

HenryRichard M
Citizen
Citizen
HenryRichard M
Citizen
Citizen
Reputation: 0
Posts: 9
Joined: 23 May 2015

Post #15by HenryRichard » 1 Jun 2015, 5:39

That's weird, whenever I do it it's rendered for 3 frames and then vanishes. Is that a bug?


Return to “LunaLua - Extension Framework”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest