LunaLua Offical Thread - SMBX Usermod Framework

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Mon Nov 16, 2015 9:47 pm

I meant onLoad(). why do I always make stupid mistakes

Also, I can't check if table.getn(tableOfNPCS) > 0, because all the NPCs are placed by the code.
Jesus is my savior.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Mon Nov 16, 2015 9:55 pm

HenryRichard wrote:I meant onLoad(). why do I always make stupid mistakes

Also, I can't check if table.getn(tableOfNPCS) > 0, because all the NPCs are placed by the code.
I gather you want to get rid of NPCs sooo...

Code: Select all

tableofNPCs = NPC.get()
for k,v in pairs(tableofNPCs) do
 v:kill()
end
Put this in the end of onLoad?
Ideas are useless if you can't make them real.
Image

User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Tue Nov 17, 2015 8:51 pm

Enjl wrote:I gather you want to get rid of NPCs sooo...

Code: Select all

tableofNPCs = NPC.get()
for k,v in pairs(tableofNPCs) do
 v:kill()
end
Put this in the end of onLoad?
...not really what I wanted, but I found that I could just use onLoadSection0 and it'd work just as well.

Also, in a completely unrealated level, I'm using this code to try and make some giant moving bouncy blocks:

Code: Select all

arrayOfBouncyBlockID = {245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 262, 315, 316, 317, 318}
arrayOfBouncyBGOID = {138, 171};
sineStep = 90;
function onLoop()
   bouncyBlocks = Block.get(arrayOfBouncyBlockID);
   for k,v in pairs(bouncyBlocks) do
		if(v:collidesWith(player) == 1) then
			bounceUp(player);
		elseif(v:collidesWith(player) == 3 and v.id ~= 245) then
			bounceDown(player);
		end
		if(player2) then
			if(v:collidesWith(player2) == 1) then
				bounceUp(player2);
			elseif(v:collidesWith(player2) == 3 and v.id ~= 245) then
				bounceDown(player2);
			end
		end
		v.speedY = math.sin(sineStep * (math.pi / 180));
    end
	bouncyBGOs = BGO.get(arrayOfBouncyBGOID);
	for k,v in pairs(bouncyBGOs) do
		v.y = v.y + math.sin(sineStep * (math.pi / 180));
    end
	sineStep = (sineStep + 6) % 360;
end

function bounceUp(thePlayer)
	if(thePlayer.jumpKeyPressing == true or thePlayer.altJumpKeyPressing == true) then
		thePlayer.speedY = -12;
		playSFX(1);
		playSFX(3);
	else
		thePlayer.speedY = -5.51634;
		playSFX(3);
	end
	thePlayer.PeachHoverAvailable = -1;
end

function bounceDown(thePlayer)
	thePlayer.speedY = 3;
	playSFX(3);
end
I can't seem to get the blocks moving by setting v.speedY, and if I just add to v.y, the blocks will glitch through NPCS and occasionally the player. Has v.speedY not been implemented yet?
Jesus is my savior.

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 4:09 am

Hi Everyone, I'm trying to get the string of the variable of a sprite, when I load the game it's say alway got userdata instead of string.
any one know how to get this value in string ? : Selleafsmb3

Code: Select all

local[b] Selleafsmb3[/b] = Graphics.loadImage(resPath .. "\\Selleafsmb3.png"); 
thanks in advance !

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 4:28 am

lotus006 wrote:Hi Everyone, I'm trying to get the string of the variable of a sprite, when I load the game it's say alway got userdata instead of string.
any one know how to get this value in string ? : Selleafsmb3

Code: Select all

local[b] Selleafsmb3[/b] = Graphics.loadImage(resPath .. "\\Selleafsmb3.png"); 
thanks in advance !
The string of the variable of the sprite? You mean storing the file directory in a different variable? What keeps you from doing that by declaring
local leafString = "../Selleafsmb3.png"
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 4:33 am

Enjl wrote:
lotus006 wrote:Hi Everyone, I'm trying to get the string of the variable of a sprite, when I load the game it's say alway got userdata instead of string.
any one know how to get this value in string ? : Selleafsmb3

Code: Select all

local[b] Selleafsmb3[/b] = Graphics.loadImage(resPath .. "\\Selleafsmb3.png"); 
thanks in advance !
The string of the variable of the sprite? You mean storing the file directory in a different variable? What keeps you from doing that by declaring
local leafString = "../Selleafsmb3.png"
nope i mean to get this value Selleafsmb3 in the printText

almost like this :

Code: Select all

printText( "powers:" .. Selleafsmb3 , 510 , 230) 
and returning this :

Code: Select all

 [b] Selleafsmb3[/b]
but the string of the loadimage wont returning this because he seeying a userdata.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 4:35 am

Graphics.drawImage(Selleafsmb3, 510, 358)

Add this line below printText. With Graphics.loadImage you're loading an image, not a string. Therefore you have to use special functions which allow you to draw images. Check out Global Functions on Wohlnet wiki for more information and options.
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 4:45 am

Enjl wrote:Graphics.drawImage(Selleafsmb3, 510, 358)

Add this line below printText. With Graphics.loadImage you're loading an image, not a string. Therefore you have to use special functions which allow you to draw images. Check out Global Functions on Wohlnet wiki for more information and options.
oops sorry for the mistake, i need to get the string not the image of the line :oops:
each time i try to printText the variable of the image i got an error

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 4:54 am

Text.print("powers: Selleafsmb3", 510, 230)

Is this what you want?

The thing with the image is that you aren't storing a string inside it and therefore it doesn't work with Text.print/printText.
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 5:03 am

Enjl wrote:Text.print("powers: Selleafsmb3", 510, 230)

Is this what you want?

The thing with the image is that you aren't storing a string inside it and therefore it doesn't work with Text.print/printText.
yep but when I put this variable in a table is doing the same thing :( I can't get just the "Selleafsmb3" text to see what is stored in the table in the 1st position.

from this

Code: Select all

local Selleafsmb3 = Graphics.loadImage(resPath .. "\\Selleafsmb3.png");
[...]

Code: Select all

[...]
printText( "Powers:" .. tostring(Selleafsmb3) , 507 , 286) 
Image

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 374
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Wed Nov 18, 2015 5:50 am

loadImage returns a Image-Object. This object is just a reference to data of pixels. It doesn't have anything else than just this data. What do you expect from converting an object which holds pixel-data when you try to convert it to a string? That makes no sense!

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 5:56 am

Kevsoft wrote:loadImage returns a Image-Object. This object is just a reference to data of pixels. It doesn't have anything else than just this data. What do you expect from converting an object which holds pixel-data when you try to convert it to a string? That makes no sense!
or else because of my inventory api will be impossible for me then to do, I need a way to get what is hovered like in the video I showed on wohlnet in the lunalua thread, if some one get an idea how to do ?



Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 6:08 am

Assuming you already have one sprite for the blue backdrop and the greyed-out powerups, the next thing you need is show a specific graphic depending on the player's position on an one-dimensional array.
To give you an example, the following code SHOULD work for letting the player move right and left on the array while showing the different icons, although it's untested:

Code: Select all

local i = 0
local graphic = {Graphics.loadImage(...), Graphics.loadImage(...), Graphics.loadImage(...) etc}
function onKeyDown(keyCode)
    if keyCode == KEY_RIGHT and i < 5 then
        i = i + 1
    end
    if keyCode == KEY_LEFT and i > 0 then
        i = i - 1
    end
    Graphics.drawImage(graphic[i], x + graphic size * i, y)
end
No guarantees. It also doesn't include stuff like locking player movement and actually selecting stuff.
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Wed Nov 18, 2015 6:36 am

Enjl wrote:Assuming you already have one sprite for the blue backdrop and the greyed-out powerups, the next thing you need is show a specific graphic depending on the player's position on an one-dimensional array.
To give you an example, the following code SHOULD work for letting the player move right and left on the array while showing the different icons, although it's untested:

Code: Select all

local i = 0
local graphic = {Graphics.loadImage(...), Graphics.loadImage(...), Graphics.loadImage(...) etc}
function onKeyDown(keyCode)
    if keyCode == KEY_RIGHT and i < 5 then
        i = i + 1
    end
    if keyCode == KEY_LEFT and i > 0 then
        i = i - 1
    end
    Graphics.drawImage(graphic[i], x + graphic size * i, y)
end
No guarantees. It also doesn't include stuff like locking player movement and actually selecting stuff.
I have already the key code set for right or left and locked player position, but in your code i'm not sure why ( local graphic = ) is on the same line?
the thing I can't get working is when the sprite highlighted I cant have the value of the sprite hovered. or to send it to a table to know on wich power name I have selected. and also I want 5 row of 6 powerups like in the original smb3 stored in a table and gathered in a random way.

I can give you the code i have so far now , but sorry if is hard to read, it's my 1st time in Lua :D

Code: Select all

local __title = "SMB Test Menu Navigator";
local __version = "0.0.1";
local __description = "Debug Menu + Cheats Menu Test";
local __author = "Lotus006";
local __url = "https://github.com/";



local DebugMenuTest_API = {} --instance

local debugenabled = 1 ;
local debugPOSMisc = 0 ;
local debugtimer = 1 ;

local CheatsMenuEnabled = 0 ;  -- 0= Off, 1= On
local MenuInvEnabled = 1 ;  -- 0= Off, 1= On
local debugpage = 3 ; -- 0= Off, 1= Page 1, 2= Page 2 

local EnableAnimHandX = 1 ;  -- 0= Hand Not Moving PosX, 1= Hand Moving PosX


local SelMushroom =  { }
local UnSelMushroom =  { }

local Selflower =  { }
local UnSelflower =  { }

local SelIceflower =  { }
local UnSelIceflower =  { }


-- setmetatable(SelMushroomA, {__index = _G})

local resPath = getSMBXPath() .. "\\LuaScriptsLib\\DebugCheatsMenu"; --res path

local arrow = Graphics.loadImage(resPath .. "\\arrow.png"); -- Stuff
local inv = Graphics.loadImage(resPath .. "\\inv.png"); -- Stuff
local inv2 = Graphics.loadImage(resPath .. "\\inv2.png"); -- Stuff


	for d=1, 7 do
	table.insert(SelMushroom, Graphics.loadImage(resPath .. "\\SelMushroom.png") );
		end			
		
		
	for d=1, 7 do
	table.insert(UnSelMushroom, Graphics.loadImage(resPath .. "\\UnSelMushroom.png") );
	end		

	
	for d=1, 7 do
	table.insert(Selflower, Graphics.loadImage(resPath .. "\\Selflower.png") );
	end			
		
		
	for d=1, 7 do
	table.insert(UnSelflower, Graphics.loadImage(resPath .. "\\UnSelflower.png") );
	end		
	
	for d=1, 7 do
	table.insert(SelIceflower, Graphics.loadImage(resPath .. "\\SelIceflower.png") );
	end			
		
		
	for d=1, 7 do
	table.insert(UnSelIceflower, Graphics.loadImage(resPath .. "\\UnSelflower.png") );
	end		

	
	
	
	
local Selleafsmb3 = Graphics.loadImage(resPath .. "\\Selleafsmb3.png"); -- Stuff
local UnSelleafsmb3 = Graphics.loadImage(resPath .. "\\UnSelleafsmb3.png"); -- Stuff
 -- local SelMushroom = Graphics.loadImage(resPath .. "\\SelMushroom.png"); -- Stuff
-- local UnSelMushroom = Graphics.loadImage(resPath .. "\\UnSelMushroom.png"); -- Stuff
-- local Selflower = Graphics.loadImage(resPath .. "\\Selflower.png"); -- Stuff
local flower = Graphics.loadImage(resPath .. "\\flower.png"); -- Stuff
-- local UnSelflower = Graphics.loadImage(resPath .. "\\UnSelflower.png"); -- Stuff
-- local UnSelIceflower = Graphics.loadImage(resPath .. "\\UnSelflower.png"); -- Stuff
-- local SelIceflower = Graphics.loadImage(resPath .. "\\SelIceflower.png"); -- Stuff

local Seltanookie = Graphics.loadImage(resPath .. "\\tanookie.png"); -- Stuff
local UnSeltanookie = Graphics.loadImage(resPath .. "\\UnSeltanookie.png"); -- Stuff
local UnSelHammer = Graphics.loadImage(resPath .. "\\UnSelHammer.png"); -- Stuff
local SelHammer = Graphics.loadImage(resPath .. "\\SelHammer.png"); -- Stuff
local UnEmptyItem = Graphics.loadImage(resPath .. "\\EmptyItem.png"); -- Stuff
local SelEmptyItem = Graphics.loadImage(resPath .. "\\EmptyItem.png"); -- Stuff


local Selbutton = Graphics.loadImage(resPath .. "\\Selbutton.png"); -- Stuff
local UnSelbutton = Graphics.loadImage(resPath .. "\\UnSelbutton.png"); -- Stuff

local debugback = Graphics.loadImage(resPath .. "\\debugback.png"); -- Stuff

local P1PlayerIcon = Graphics.loadImage(resPath .. "\\P1PlayerIcon.png"); -- Stuff
local P2PlayerIcon = Graphics.loadImage(resPath .. "\\P2PlayerIcon.png"); -- Stuff
local Rbutton = Graphics.loadImage(resPath .. "\\Rbutton.png"); -- Stuff

local hand = Graphics.loadImage(resPath .. "\\hand.png"); -- Stuff
local handdown = Graphics.loadImage(resPath .. "\\handdown.png"); -- Stuff


local TimerActivate = 0
local TimerSet = 2
local TimerSecondeleft = TimerSet
local TimerTick = 0.1
local addthis = 0

local PosItemsX = 1
local testthisvar = 0

local MoveTheHandX = 0.7
	
local HandPosY = 0

local lives = 0
local NPCToObject = ""
local GodMode = 0

local powerups = 0

local closemenu = 1

MenuCheatsStuff =  {}

Menu1PosY = {0, 30, 60, 90, 120, 170}

ItemsSelSpritesPosX = {190, 253, 310, 370, 430, 490, 550}
ItemsSelSpritesPosY = {535, 535, 535, 535, 535, 535, 535}


ItemsSlotsPos = {}

local ta = {}


MenuItemCheats = { "turn Enemy", "God Mode", "add lives",  "   Debug Menu", "   PowerUps Menu" }

MenuClose = {"Close Cheats Menu"}

local TPauseKey = 0
local TPauseVar = 0

local j1 = 0
local timeLimit = 20



local UnItems = {UnSelMushroom[1], UnSelflower[1], UnSelIceflower[1], UnSelleafsmb3, UnSeltanookie, UnSelHammer, EmptyItem}

local SelItems = {SelMushroom[1], Selflower[1], SelIceflower[1], Selleafsmb3, Seltanookie, SelHammer, EmptyItem}

local A = { PLAYER_BIG, PLAYER_FIREFLOWER, PLAYER_ICE, PLAYER_LEAF, PLAYER_TANOOKIE, PLAYER_HAMMER }

local UnItems1 = UnSelMushroom[1]
local UnItems2 = UnSelflower[1]
local UnItems3 = UnSelIceflower[1]
local UnItems4 = UnSelleafsmb3
local UnItems5 = UnSeltanookie
local UnItems6 = UnSelHammer
local UnItems7 = UnEmptyItem



local SelItems1 = SelMushroom[1]
local SelItems2 = Selflower[1] 
local SelItems3 = SelIceflower[1] 
local SelItems4 = Selleafsmb3
local SelItems5 = Seltanookie
local SelItems6 = SelHammer 
local SelItems7 = SelEmptyItem 



local RemoveTest = 0

 -- local PowerUpsSelSprites = { SelMushroom, Selflower, Seltanookie, Selleafsmb3, SelIceflower }
 --local PowerUpsSelSprites = { "SelMushroom", "Selflower", "Seltanookie", "Selleafsmb3", "SelIceflower" }

 -- local spritesA =  { This = "That", Those = "These", Him = "Her" }
 
 spritesA = {
  --  [SelItems1] = UnItems1 ,
  --  [SelItems2] = UnItems2 ,
  --  [SelItems7] = UnItems7 ,
}
 
 

 

local PowerUpsSelSprites = {
-- "SelItems1",
-- "SelItems7" ,
-- "SelItems2" ,

}

 

local PowerUpsUnSelSprites = {
 UnItems1 ,
 UnItems7 ,
 UnItems2 ,

}


local index = 2


local powerupsitemsstock = {
PLAYER_BIG ,
PLAYER_FIREFLOWER ,
PLAYER_ICE ,
PLAYER_LEAF ,
PLAYER_TANOOKIE ,
PLAYER_HAMMER 
}

local playerselect = { "CHARACTER_LUIGI" , "CHARACTER_LINK" }



function table.map_length(t)
    local c = 0
    for k,v in pairs(t) do
         c = c+1
    end
    return c
end

 local ItemsSlot =  { }
local timeAA = 1

 
 local SpriteLines = table.map_length(spritesA)

local LineSpritesTable = table.map_length(PowerUpsSelSprites)

local ThisItemsSlots =  math.floor(PosItemsX)


 function DebugMenuTest_API.onInitAPI()
   registerEvent(DebugMenuTest_API, "onLoop", "onLoopOverride");
    registerEvent(DebugMenuTest_API, "onLoad", "onLoadOverride");
    registerEvent(DebugMenuTest_API, "onInputUpdate", "onInputUpdateOverride");
	
	

 
 end
 
 
function DebugMenuTest_API.onLoopOverride()

  
 ItemsTable = table.getn(UnItems)

if (TimerSecondeleft > 1) and (TimerActivate == 1)  then

TimerSecondeleft = TimerSecondeleft - TimerTick


end

if (TimerSecondeleft < 2) then

TimerSecondeleft = 1

end


if (TimerActivate > 1) then
TimerActivate = 1

end

  if (debugpage == 1) then	
	
 printText(   "Moving Stuff" , 536, 96 )
 
 printText(   "---------------" , 505, 119 )
 printText(   "MoveHandX:" .. MoveTheHandX , 507, 147 )
 
 printText(   "TimerSleft:" .. math.floor(TimerSecondeleft)  , 507, 170 )
 
 printText(   "testvar:" .. testthisvar  , 507, 224 )
  printText(   "pausekey:" .. math.floor(TPauseKey) , 506, 340 )
  printText(   "timeAA:" .. math.floor(timeAA) , 506, 363 )
  
   printText(   "Page:1/3" , 630, 390 )
   
    printText( "RemoveTest:" .. RemoveTest , 507 + 10 , 286 - 10) 
	
else

 printText(   "Page:1/3" , 630, 390 )

end	

 

  if (debugpage == 3) then	
  
   printText(   "Table Stuff" , 543, 97 )
 
 printText(   "---------------" , 505, 119 )
  
   printText(   "Page:2/3" , 630, 390 )
   
     printText( "Lines:" .. math.floor(TimerSecondeleft) , 510 , 200) 
     printText( "ta:" .. tostring(ta), 510 , 230) 
     


  else
   
   printText(   "Page:2/3" , 630, 390 )
  
  end
  
  

	
	Graphics.unplaceSprites(inv);
    Graphics.placeSprite(1,inv,   10  , 40  );	
	
		
	Graphics.unplaceSprites(debugback);
    Graphics.placeSprite(1,debugback,  490  , 40  );	
	
 
 	Graphics.unplaceSprites(hand);
	Graphics.placeSprite(1,hand, 10  ,  10);
 
	
	Graphics.unplaceSprites(inv2);
    Graphics.placeSprite(1,inv2,   160  , 518   );
 
 	
	Graphics.unplaceSprites(Rbutton);
    Graphics.placeSprite(1,Rbutton,   176  , 496   );
  
  

  
 
if (TPauseKey == 1) then 

CheatsMenuEnabled = 1
else

CheatsMenuEnabled = 0
end


timeAA = timeAA + TPauseVar


 if (TPauseKey == 1) then
 TPauseVar = 0.1
else 
 TPauseVar = 0
end

 if (timeAA >= 2) then
  timeAA = 2
  
  end
  
  if (timeAA == 2)  then
  
  
  end
  
  if (player.pauseKeyPressing) and (timeAA >= 2)then
  timeAA = 2
  TPauseVar = 0
  end
  
  
 
  if (PosItemsX < 1) then
  PosItemsX = 1
  end
 
   
  if (PosItemsX >= ItemsTable ) then
  PosItemsX = ItemsTable 
  end

 local GetLinePUpsUnSelSprites = table.getn(PowerUpsUnSelSprites)

 
 local TimerA = math.floor(PosItemsX)
 
if (debugpage == 1) then	

 printText(   "PosItemsX:" .. math.floor(PosItemsX)   , 507, 200 )
 printText(   "items:" .. ItemsTable  , 507, 260 )
 else
 
 end


 
 for k,v in pairs (PowerUpsSelSprites) do
 
    if (debugpage == 2) then

  printText( "Lines:" .. SpriteLines , 507 + 20 , 286 + 20)  
 
 
 end
  
 end
 

 
 for k,v in pairs (PowerUpsUnSelSprites) do
  

  
  if (debugpage == 1) then	
  
  -- printText(   "Cheats Act:" .. CheatsMenuEnabled  , 507, 223 )
  -- printText(   "k Value:" .. k   , 507, 246 )
  
 else
 
 end

		end
	

ThatSlot = math.floor(PosItemsX) 
			


  	Graphics.unplaceSprites( SelMushroom[1] ) ;
  Graphics.placeSprite(1, SelMushroom[1], 190 , 400 ) ; 	

	
  	Graphics.unplaceSprites( SelMushroom[2] ) ;
  Graphics.placeSprite(1, SelMushroom[2], 253  , 400 ) ; 	

	
	
	Graphics.unplaceSprites( UnItems[1] ) ;
	Graphics.placeSprite(1, UnItems[1], ItemsSelSpritesPosX[1] , ItemsSelSpritesPosY[1] ) ; 	
	
	
	Graphics.unplaceSprites( UnItems[2]) ;
	Graphics.placeSprite(1, UnItems[2], ItemsSelSpritesPosX[2] , ItemsSelSpritesPosY[2] ) ; 	
	
	
	
	Graphics.unplaceSprites( UnItems[3]) ;
	Graphics.placeSprite(1, UnItems[3], ItemsSelSpritesPosX[3] , ItemsSelSpritesPosY[3] ) ; 	
	
	
	Graphics.unplaceSprites( UnItems4) ;
	Graphics.placeSprite(1, UnItems4, ItemsSelSpritesPosX[4] , ItemsSelSpritesPosY[4] ) ; 		
	
	Graphics.unplaceSprites( UnItems5) ;
	Graphics.placeSprite(1, UnItems5, ItemsSelSpritesPosX[5] , ItemsSelSpritesPosY[5] ) ; 	
	
	
	Graphics.unplaceSprites( UnItems6) ;
	Graphics.placeSprite(1, UnItems6, ItemsSelSpritesPosX[6] , ItemsSelSpritesPosY[6] ) ; 	


	if (ThatSlot == 1) then
	
		Graphics.unplaceSprites( SelItems[1]) ;
	Graphics.placeSprite(1, SelItems[1], ItemsSelSpritesPosX[1] , ItemsSelSpritesPosY[1] ) ; 	

	elseif  (ThatSlot == 2) then
		Graphics.unplaceSprites( SelItems[2]) ;
	Graphics.placeSprite(1, SelItems[2], ItemsSelSpritesPosX[2] , ItemsSelSpritesPosY[2] ) ; 


	
	elseif  (ThatSlot == 3) then
		Graphics.unplaceSprites( SelItems[3]) ;
	Graphics.placeSprite(1, SelItems[3], ItemsSelSpritesPosX[3] , ItemsSelSpritesPosY[3] ) ; 
		

	
	elseif  (ThatSlot == 4) then
		Graphics.unplaceSprites( SelItems4) ;
	Graphics.placeSprite(1, SelItems4, ItemsSelSpritesPosX[4] , ItemsSelSpritesPosY[4] ) ; 


	
	elseif  (ThatSlot == 5) then
		Graphics.unplaceSprites( SelItems5) ;
	Graphics.placeSprite(1, SelItems5, ItemsSelSpritesPosX[5] , ItemsSelSpritesPosY[5] ) ; 


	
	elseif  (ThatSlot == 6) then
		Graphics.unplaceSprites( SelItems6) ;
	Graphics.placeSprite(1, SelItems6, ItemsSelSpritesPosX[6] , ItemsSelSpritesPosY[6] ) ; 

	
	end
	

 
	  table.insert(ItemsSlotsPos, 1, "tessst")
	
	  
	for i=1, ItemsTable - 1  do

 Text.print("powers:" , 510, 180) 
  if (player.runKeyPressing) then

  for k,v in pairs (SelItems[1]) do
  printText(   "This:" .. k .. " " .. tostring(v)  , 507, 243 + 20 * k )
  
  end
  
  
	
	--	 UnItems[2] = UnSelMushroom[2]
--	  SelItems[2] = SelMushroom[2]
		  
	--	 UnItems3 = UnSelMushroom[3]
	--  SelItems3 = SelMushroom[3]

	end


	if (player.pauseKeyPressing) then
	
	 
	  player.powerup = A[2]
	
	end
	
--[[
if (RemoveTest == 1) then

else
	
end


	
	if (ThatSlot == i) then
		

	Graphics.unplaceSprites( UnItems[i]) ;
	Graphics.unplaceSprites( SelItems[i]) ;
	Graphics.placeSprite(1, SelItems[i] , ItemsSelSpritesPosX[i] , ItemsSelSpritesPosY[i] ) ; 	
	
	
	end
	
	-- ]]

	
	
	end

	
	if(getInput().str:find("cheats")) then
	 
		if (CheatsMenuEnabled ~= 1) then
		CheatsMenuEnabled = 1
	end
	--  getInput():clear()

	end
 
end
	
	
function DebugMenuTest_API.onInputUpdateOverride()

if(player.runKeyPressing) then
 
   end


	if (player.downKeyPressing) then

	end 
	
	if (player.upKeyPressing) then
	
	end

	if (player.leftKeyPressing) then
		addthis = 0.23 
		PosItemsX = PosItemsX - addthis
		else
		addthis = 0
	end
	


	if(player.pauseKeyPressing) then
	
	TPauseKey = 1
	end
	
	
	if (player.rightKeyPressing)  then
		addthis = 0.23
		PosItemsX = PosItemsX + addthis
		
		printText( "ttttt" , 507  , 386  )  -- ici --
		-- player.rightKeyPressing = false;
	
		
	
	end
	
	
	
	if (player.pauseKeyPressing)  then
			if (TimerSecondeleft == 1)    then
				TimerSecondeleft = TimerSet
			end
	end
	
	
	
	if (player.pauseKeyPressing)  and (TimerSecondeleft > TimerSet - 1)  then
		TimerActivate = TimerActivate + 1
	end		
	

end

return DebugMenuTest_API

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 6:51 am

You're not trying to access a value of the powerup. What I did is create a table of powerup sprites and store them all in powerup. powerup[0] is the first sprite, powerup[1] is the second, and you can continue that for as long as you want. It's a more compact way of writing all those long names. You just gotta remember the number associated with each powerup (e.g. make a comment).

In my code above I assumed you wanted this for debug stuff. Giving the player a powerup of their choice whenever they want. Storing them in order of being collected works a bit differently. In this case you have a variable for the current inventory size, and adjust the size or it accordingly. I'm not sure whether this inventory of powerups can be saved between levels. I'd use the data class to point to the powerups the player currently has, and in which order they're present. (However I don't know if this also works in APIs)
Ideas are useless if you can't make them real.
Image

User avatar
FrozenSolid
Cheep-Cheep
Cheep-Cheep
Posts: 12
Joined: Tue Jul 07, 2015 3:40 pm
Current Project: Unrevealed Smbx Mamoth Project.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby FrozenSolid » Wed Nov 18, 2015 10:14 am

So, i have downloaded it to another destination than my SMBX (Actually, even another Hard-Drive), installed and went into the Intro level...but now....how do i actually programm stuff? D:
Image

Image


I also Stream from time to time in German and in English, and also do editing Streams of my Projects! go watch me at twitch.tv/storm_lakitu2

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Wed Nov 18, 2015 10:24 am

FrozenSolid wrote:So, i have downloaded it to another destination than my SMBX (Actually, even another Hard-Drive), installed and went into the Intro level...but now....how do i actually programm stuff? D:
Start by reading some of the tutorials here http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Nov 19, 2015 2:57 am

Enjl wrote:You're not trying to access a value of the powerup. What I did is create a table of powerup sprites and store them all in powerup. powerup[0] is the first sprite, powerup[1] is the second, and you can continue that for as long as you want. It's a more compact way of writing all those long names. You just gotta remember the number associated with each powerup (e.g. make a comment).

In my code above I assumed you wanted this for debug stuff. Giving the player a powerup of their choice whenever they want. Storing them in order of being collected works a bit differently. In this case you have a variable for the current inventory size, and adjust the size or it accordingly. I'm not sure whether this inventory of powerups can be saved between levels. I'd use the data class to point to the powerups the player currently has, and in which order they're present. (However I don't know if this also works in APIs)
thanks for the idea about ( local graphic = {Graphics.loadImage(...) ) you give me a way how to accomplish the storing of powerups (i have my idea :P)

the last thing I need (i think this one should be more doable) is there a way to insert like in the start in a table

Code: Select all

1= Mushroom , 2 = FireFlower, 3= IceFlower, 4= Hammer, 5= Tanookie, 6= Leaf

Code: Select all

local PowersInventory = { 1, 2, 2, 4, 3, 6 } 

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8736
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Thu Nov 19, 2015 4:11 am

What ypu're asking for is exactly what you just thanked me for :P

If you do
local powerups = {Graphics.loadImage("image mushroom"), Graphics.loadImage("image flower")}

Then you'll be able to reference them like this (I don't know whether it starts at 0 or 1 right now, so you'll need to test that out):
powerups[1] gives you the Mushroom image,
powerups[2] gives you the Flower image.

Storing them into something else is something you CAN do, but it's useless, because all it does is probably make it less easy to look at. You can not, however, store them to simple numbers, because as Kevsoft said, they're the images you loaded.

Why would you even want the numbers 1-6 in a table anyways?
Ideas are useless if you can't make them real.
Image

lotus006
Mega Mole
Mega Mole
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Nov 19, 2015 4:27 am

Enjl wrote:What ypu're asking for is exactly what you just thanked me for :P

If you do
local powerups = {Graphics.loadImage("image mushroom"), Graphics.loadImage("image flower")}

Then you'll be able to reference them like this (I don't know whether it starts at 0 or 1 right now, so you'll need to test that out):
powerups[1] gives you the Mushroom image,
powerups[2] gives you the Flower image.

Storing them into something else is something you CAN do, but it's useless, because all it does is probably make it less easy to look at. You can not, however, store them to simple numbers, because as Kevsoft said, they're the images you loaded.

Why would you even want the numbers 1-6 in a table anyways?
for emulate the inventory stockage.

but about the image i found a solution without using string from the name of the sprites :)
when I removed the value of the sprite in the table I made a security mesure like when this value from the table is deleted then is nil and then
there is no more error. :)

then why I need to have 1 to 6 in a table to indicate the value of the powerups when I add in example
PowerUps = { 1, 2, 5 }
or
PowerUps = { 1, 2, 5, 6, 1 }
then the last 3 value is non existen is not return an error of sprite not loaded now :)
and when the game start I need a way to have the value 1, 2, 5 in the inventory
and after I can save the progress with the data save command in any level :)

Edit :
Damn sorry, I found already how, its cool it's working now :) i can put any powerups i want in the inventory and with the number this is pretty awsome :)

but now the only thing its buggy is when 2 sprites is the same is non appearing crap :( , I will find (i hope) :D :D :D

I'm so happy

EDIT 2

Code: Select all

local AInventory = { 4, 3, 2, 5, 6, 3}
3= Ice Flower

Code: Select all

for i=1, 7 do
       table.insert(UnSelItems, AUnSel[AInventory[1]])
         table.insert(SelItems,  ASel[AInventory[1]]) 

       table.insert(UnSelItems, AUnSel[AInventory[2]])
         table.insert(SelItems, ASel[AInventory[2]]) 

       table.insert(UnSelItems,  AUnSel[AInventory[3]])
         table.insert(SelItems, ASel[AInventory[3]]) 
   
       table.insert(UnSelItems,  AUnSel[AInventory[4]])
         table.insert(SelItems,  ASel[AInventory[4]])    
    
      table.insert(UnSelItems,  AUnSel[AInventory[5]])
         table.insert(SelItems, ASel[AInventory[5]]) 
   
      table.insert(UnSelItems, AUnSel[AInventory[6]])
         table.insert(SelItems, ASel[AInventory[6]]) 
end
   
I'm lost now :(
I suspect between the line 177 and 195 it's make the ice flower sprites duplicated then the sprite unselected is not appearing

Code: Select all

local __title = "SMB Test Menu Navigator";
local __version = "0.0.1";
local __description = "Debug Menu + Cheats Menu Test";
local __author = "Lotus006";
local __url = "https://github.com/";



local DebugMenuTest_API = {} --instance

local debugenabled = 1 ;
local debugPOSMisc = 0 ;
local debugtimer = 1 ;

local CheatsMenuEnabled = 0 ;  -- 0= Off, 1= On
local MenuInvEnabled = 1 ;  -- 0= Off, 1= On
local debugpage = 3 ; -- 0= Off, 1= Page 1, 2= Page 2 

local EnableAnimHandX = 1 ;  -- 0= Hand Not Moving PosX, 1= Hand Moving PosX


local SelMushroom =  { }
local UnSelMushroom =  { }

local Selflower =  { }
local UnSelflower =  { }

local SelIceflower =  { }
local UnSelIceflower =  { }

local Selleafsmb3 =  { }
local UnSelleafsmb3 =  { }


local Seltanookie =  { }
local UnSeltanookie =  { }

local SelHammer =  { }
local UnSelHammer =  { }

local SelEmptyItem =  { }
local UnSelEmptyItem =  { }

local resPath = getSMBXPath() .. "\\LuaScriptsLib\\DebugCheatsMenu"; --res path

local arrow = Graphics.loadImage(resPath .. "\\arrow.png"); -- Stuff
local inv = Graphics.loadImage(resPath .. "\\inv.png"); -- Stuff
local inv2 = Graphics.loadImage(resPath .. "\\inv2.png"); -- Stuff


local PowersSprites =  { }

for i=1, 7 do
	table.insert(SelMushroom, Graphics.loadImage(resPath .. "\\SelMushroom.png") );
	table.insert(UnSelMushroom, Graphics.loadImage(resPath .. "\\UnSelMushroom.png") );
	
	table.insert(Selflower, Graphics.loadImage(resPath .. "\\Selflower.png") );
	table.insert(UnSelflower, Graphics.loadImage(resPath .. "\\UnSelflower.png") );
	
	table.insert(SelIceflower, Graphics.loadImage(resPath .. "\\SelIceflower.png") );
	table.insert(UnSelIceflower, Graphics.loadImage(resPath .. "\\UnSelflower.png") );	

	table.insert(Selleafsmb3, Graphics.loadImage(resPath .. "\\Selleafsmb3.png") );
	table.insert(UnSelleafsmb3, Graphics.loadImage(resPath .. "\\UnSelleafsmb3.png") );	
	
	table.insert(Seltanookie, Graphics.loadImage(resPath .. "\\Seltanookie.png") );
	table.insert(UnSeltanookie, Graphics.loadImage(resPath .. "\\UnSeltanookie.png") );
	
	table.insert(SelHammer, Graphics.loadImage(resPath .. "\\SelHammer.png") );
	table.insert(UnSelHammer, Graphics.loadImage(resPath .. "\\UnSelHammer.png") );	

	table.insert(SelEmptyItem, Graphics.loadImage(resPath .. "\\SelEmptyItem.png") );
	table.insert(UnSelEmptyItem, Graphics.loadImage(resPath .. "\\UnSelEmptyItem.png") );
end
	

local Selbutton = Graphics.loadImage(resPath .. "\\Selbutton.png"); -- Stuff
local UnSelbutton = Graphics.loadImage(resPath .. "\\UnSelbutton.png"); -- Stuff

local debugback = Graphics.loadImage(resPath .. "\\debugback.png"); -- Stuff

local P1PlayerIcon = Graphics.loadImage(resPath .. "\\P1PlayerIcon.png"); -- Stuff
local P2PlayerIcon = Graphics.loadImage(resPath .. "\\P2PlayerIcon.png"); -- Stuff
local Rbutton = Graphics.loadImage(resPath .. "\\Rbutton.png"); -- Stuff

local hand = Graphics.loadImage(resPath .. "\\hand.png"); -- Stuff
local handdown = Graphics.loadImage(resPath .. "\\handdown.png"); -- Stuff


local TimerActivate = 0
local TimerSet = 2
local TimerSecondeleft = TimerSet
local TimerTick = 0.1
local addthis = 0

local PosItemsX = 1
local testthisvar = 0

local MoveTheHandX = 0.7
	
local HandPosY = 0

local lives = 0
local NPCToObject = ""
local GodMode = 0

local powerups = 0

local closemenu = 1

local testsprite = 1

MenuCheatsStuff =  {}

Menu1PosY = {0, 30, 60, 90, 120, 170}

ItemsSelSpritesPosX = {190, 253, 310, 370, 430, 490, 550}
ItemsSelSpritesPosY = {535, 535, 535, 535, 535, 535, 535}



local ta = {"a1", "b2", "c3", "d4" , "e5"}


MenuItemCheats = { "turn Enemy", "God Mode", "add lives",  "   Debug Menu", "   PowerUps Menu" }

MenuClose = {"Close Cheats Menu"}

local TPauseKey = 0
local TPauseVar = 0

local AInventory = {  }


local SelItems = { }

local UnSelItems = { }

 
local AUnSel = { UnSelMushroom[5], UnSelflower[3], UnSelIceflower[1], UnSelleafsmb3[4], UnSeltanookie[6], UnSelHammer[2], UnSelEmptyItem[7] }


local ASel = { SelMushroom[2], Selflower[4], SelIceflower[1], Selleafsmb3[5], Seltanookie[3], SelHammer[7], SelEmptyItem[6] }


local A = { PLAYER_BIG, PLAYER_FIREFLOWER, PLAYER_ICE, PLAYER_LEAF, PLAYER_TANOOKIE, PLAYER_HAMMER, PLAYER_SMALL }

	
local AInventory = { 4, 3, 2, 5, 6, 3}
local RemoveTest = 0

function table.map_length(t)
    local c = 0
    for k,v in pairs(t) do
         c = c+1
    end
    return c
end

local timeAA = 1


local ThisItemsSlots =  math.floor(PosItemsX)



	



 function DebugMenuTest_API.onInitAPI()
   registerEvent(DebugMenuTest_API, "onLoop", "onLoopOverride");
    registerEvent(DebugMenuTest_API, "onLoad", "onLoadOverride");
    registerEvent(DebugMenuTest_API, "onInputUpdate", "onInputUpdateOverride");


for i=1, 7 do
	 	table.insert(UnSelItems, AUnSel[AInventory[1]])
	 	  table.insert(SelItems,  ASel[AInventory[1]]) 

	 	table.insert(UnSelItems, AUnSel[AInventory[2]])
	 	  table.insert(SelItems, ASel[AInventory[2]]) 

	 	table.insert(UnSelItems,  AUnSel[AInventory[3]])
	 	  table.insert(SelItems, ASel[AInventory[3]]) 
	
	 	table.insert(UnSelItems,  AUnSel[AInventory[4]])
	 	  table.insert(SelItems,  ASel[AInventory[4]]) 	
	 
		table.insert(UnSelItems,  AUnSel[AInventory[5]])
	 	  table.insert(SelItems, ASel[AInventory[5]]) 
	
		table.insert(UnSelItems, AUnSel[AInventory[6]])
	 	  table.insert(SelItems, ASel[AInventory[6]]) 
end
	
 end
 


 
function DebugMenuTest_API.onLoopOverride()
		
	


ThatSlot = math.floor(PosItemsX) 

local thisslut = AInventory[ThatSlot]

			
 if (ThatSlot <=1) then
 ThatSlot = 1
 else
 
 
 end
  
 ItemsTable = table.getn(UnSelItems)
 
 
 ValuePowerSlot = table.getn(UnSelItems)

if (TimerSecondeleft > 1) and (TimerActivate == 1)  then

TimerSecondeleft = TimerSecondeleft - TimerTick


end

if (TimerSecondeleft < 2) then

TimerSecondeleft = 1

end


if (TimerActivate > 1) then
TimerActivate = 1

end

  if (debugpage == 1) then	
	
 printText(   "Moving Stuff" , 536, 96 )
 
 printText(   "---------------" , 505, 119 )
 printText(   "MoveHandX:" .. MoveTheHandX , 507, 147 )
 
 printText(   "TimerSleft:" .. math.floor(TimerSecondeleft)  , 507, 170 )
 
 printText(   "testvar:" .. testthisvar  , 507, 224 )
  printText(   "pausekey:" .. math.floor(TPauseKey) , 506, 340 )
  printText(   "timeAA:" .. math.floor(timeAA) , 506, 363 )
  
   printText(   "Page:1/3" , 630, 390 )
   
    printText( "RemoveTest:" .. RemoveTest , 507 + 10 , 286 - 10) 
	
else

 printText(   "Page:1/3" , 630, 390 )

end	

 

 

  if (debugpage == 3) then	
  
   printText(   "Table Stuff" , 543, 97 )
 
 printText(   "---------------" , 505, 119 )
  
   printText(   "Page:2/3" , 630, 390 )
   
     printText( "Lines:" .. math.floor(TimerSecondeleft) , 510 , 200) 
     
		printText(   "PosItemsX:" .. ThatSlot   , 578, 368)
		printText(   "items:" .. ValuePowerSlot  , 578, 345 )
	-- 	printText(   "thisslut:" .. thisslut  , 578, 318 )
	 
	 for k,v in pairs(ta) do
	 
	  printText( k.. ":" .. v , 510 , 230 + 18 * k) 
     
	 end

	 
	 if (player.runKeyPressing) then
	 

-- table.remove(AInventory, 1)

	 

	  for k,v in pairs(ta) do
	
	 ta[3] = nil
	 ta[1] = nil
	 end
end

  else
   
   printText(   "Page:2/3" , 630, 390 )
  
  end
  
  if (ThatSlot >= 7) then
  ThatSlot = 6
  else
  
  end


  if (player.pauseKeyPressing) then

	 -- ThatSlot
	
	if (thisslut == nil) then
	
	else
	player.powerup = tonumber(A[thisslut])
	
	end
	
	end

  
  
  

	Graphics.unplaceSprites(inv);
    Graphics.placeSprite(1,inv,   10  , 40  );	
	
		
	Graphics.unplaceSprites(debugback);
    Graphics.placeSprite(1,debugback,  490  , 40  );	
	
 
 	Graphics.unplaceSprites(hand);
	Graphics.placeSprite(1,hand, 10  ,  10);
 
	
	Graphics.unplaceSprites(inv2);
    Graphics.placeSprite(1,inv2,   160  , 518   );
 
 	
	Graphics.unplaceSprites(Rbutton);
    Graphics.placeSprite(1,Rbutton,   176  , 496   );
 	

  

  
 
if (TPauseKey == 1) then 

CheatsMenuEnabled = 1
else

CheatsMenuEnabled = 0
end


timeAA = timeAA + TPauseVar


 if (TPauseKey == 1) then
 TPauseVar = 0.1
else 
 TPauseVar = 0
end

 if (timeAA >= 2) then
  timeAA = 2
  
  end
  
  if (timeAA == 2)  then
  
  
  end
  
  if (player.pauseKeyPressing) and (timeAA >= 2)then
  timeAA = 2
  TPauseVar = 0
  end
  
  
 
  if (PosItemsX < 1) then
  PosItemsX = 1
  end
 
   
  if (PosItemsX >= ValuePowerSlot ) then
  PosItemsX = ValuePowerSlot 
  end

 
if (debugpage == 1) then	


 else
 
 end



 
    if (debugpage == 2) then

  
 
 
 end

 

 

  
  if (debugpage == 1) then	
  
else
 
 end


	
		
	if (UnSelItems[1] == nil) then
	
	else
	Graphics.unplaceSprites( UnSelItems[1] ) ;
	Graphics.placeSprite(1, UnSelItems[1], ItemsSelSpritesPosX[1] , ItemsSelSpritesPosY[1] ) ; 	
	end
		
	if (UnSelItems[2] == nil) then
	
	else
	Graphics.unplaceSprites( UnSelItems[2]) ;
	Graphics.placeSprite(1, UnSelItems[2], ItemsSelSpritesPosX[2] , ItemsSelSpritesPosY[2] ) ; 	
	end
	
	if (UnSelItems[3] == nil) then
	
	else
	Graphics.unplaceSprites( UnSelItems[3]) ;
	Graphics.placeSprite(1, UnSelItems[3], ItemsSelSpritesPosX[3] , ItemsSelSpritesPosY[3] ) ; 	
	end
	
	if (UnSelItems[4] == nil) then
	
	else
	Graphics.unplaceSprites( UnSelItems[4]) ;
	Graphics.placeSprite(1, UnSelItems[4], ItemsSelSpritesPosX[4] , ItemsSelSpritesPosY[4] ) ; 		
	end
	
	if (UnSelItems[5] == nil) then
	
	else
	
	Graphics.unplaceSprites( UnSelItems[5]) ;
	Graphics.placeSprite(1, UnSelItems[5], ItemsSelSpritesPosX[5] , ItemsSelSpritesPosY[5] ) ; 	
	end
	
	if (UnSelItems[6] == nil) then
	
	else
	Graphics.unplaceSprites( UnSelItems[6]) ;
	Graphics.placeSprite(1, UnSelItems[6], ItemsSelSpritesPosX[6] , ItemsSelSpritesPosY[6] ) ; 	
	end

	if (ThatSlot == 1) and (UnSelItems[1] ~= nil) then
	
		Graphics.unplaceSprites( SelItems[1]) ;
	Graphics.placeSprite(1, SelItems[1], ItemsSelSpritesPosX[1] , ItemsSelSpritesPosY[1] ) ; 	

	elseif  (ThatSlot == 2) and (UnSelItems[2] ~= nil) then
		Graphics.unplaceSprites( SelItems[2]) ;
	Graphics.placeSprite(1, SelItems[2], ItemsSelSpritesPosX[2] , ItemsSelSpritesPosY[2] ) ; 


	
	elseif  (ThatSlot == 3) and (UnSelItems[3] ~= nil) then
		Graphics.unplaceSprites( SelItems[3]) ;
	Graphics.placeSprite(1, SelItems[3], ItemsSelSpritesPosX[3] , ItemsSelSpritesPosY[3] ) ; 
		

	
	elseif  (ThatSlot == 4) and (UnSelItems[4] ~= nil) then
		Graphics.unplaceSprites( SelItems[4]) ;
	Graphics.placeSprite(1, SelItems[4], ItemsSelSpritesPosX[4] , ItemsSelSpritesPosY[4] ) ; 


	
	elseif  (ThatSlot == 5) and (UnSelItems[5] ~= nil) then
		Graphics.unplaceSprites( SelItems[5]) ;
	Graphics.placeSprite(1, SelItems[5], ItemsSelSpritesPosX[5] , ItemsSelSpritesPosY[5] ) ; 


	
	elseif  (ThatSlot == 6) and (UnSelItems[6] ~= nil) then
		Graphics.unplaceSprites( SelItems[6]) ;
	Graphics.placeSprite(1, SelItems[6], ItemsSelSpritesPosX[6] , ItemsSelSpritesPosY[6] ) ; 

	
	end
	

	for i=1, ItemsTable - 1  do

 Text.print("powers:" , 510, 180) 



end

	
	if(getInput().str:find("cheats")) then
	 
		if (CheatsMenuEnabled ~= 1) then
		CheatsMenuEnabled = 1
	end
	--  getInput():clear()

	end
 
end
	
	
function DebugMenuTest_API.onInputUpdateOverride()

if(player.runKeyPressing) then
 
   end


	if (player.downKeyPressing) then

	end 
	
	if (player.upKeyPressing) then
	
	end

	if (player.leftKeyPressing) then
		addthis = 0.23 
		PosItemsX = PosItemsX - addthis
		else
		addthis = 0
	end
	


	if(player.pauseKeyPressing) then
	
	TPauseKey = 1
	end
	
	
	if (player.rightKeyPressing)  then
		addthis = 0.23
		PosItemsX = PosItemsX + addthis
		
		printText( "ttttt" , 507  , 386  )  -- ici --
		-- player.rightKeyPressing = false;
	
		
	
	end
	
	
	
	if (player.pauseKeyPressing)  then
			if (TimerSecondeleft == 1)    then
				TimerSecondeleft = TimerSet
			end
	end
	
	
	
	if (player.pauseKeyPressing)  and (TimerSecondeleft > TimerSet - 1)  then
		TimerActivate = TimerActivate + 1
	end		
	

end

return DebugMenuTest_API


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 8 guests