Need help with lua? - LunaLua General Help

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?
PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Mar 18, 2016 11:38 am

Okay. Here's what I've done now:

Code: Select all

storedpower = false
change = false
canchange = false

function onTick()
	if player.powerup ~= PLAYER_SMALL or player.powerup ~= PLAYER_BIG then
		storedpower = true
	end
   
	if player.powerup == PLAYER_SMALL then
		if storedpower == true then
			change = true
			storedpower = false
		end
	end
	
	if change == true and canchange == true then
		player.powerup = PLAYER_BIG
	end
	
	while player:mem(0x122,FIELD_WORD ) == 2 do
		canchange = false
	end
end
But I'm getting this crash and error report each time:

Code: Select all

**************************************************
*                  Summary                       *
**************************************************
SMBX has crashed due an error. See the description for more information!
LunaLua Version: LUNALUA V0.7.3.0 BETA
Time/Date: 2016-03-18 11 37 13
**************************************************
*              Description                       *
**************************************************
Exception code: 0xc0000005

If you like to help us finding the error then please post this log at:
* http://engine.wohlnet.ru/forum/ or
* http://www.supermariobrosx.org/forums/viewforum.php?f=35 or
* http://talkhaus.raocow.com/viewforum.php?f=36

**************************************************
*              Stacktrace                        *
**************************************************


**** LIBRARY INFORMATION ****
SymInit: Symbol-SearchPath: '.;C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta;C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta;C:\Windows;C:\Windows\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: 'Daniel'
OS-Version: 6.1.7601 (Service Pack 1) 0x300-0x1
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\smbx.exe.legacy:smbx.exe.legacy (00400000), size: 7626752 (result: 0), SymType: '-nosymbols-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\smbx.exe.legacy', fileVersion: 1.3.0.1
C:\Windows\SysWOW64\ntdll.dll:ntdll.dll (77210000), size: 1572864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SysWOW64\ntdll.dll', fileVersion: 6.1.7601.19110
C:\Windows\syswow64\kernel32.dll:kernel32.dll (753E0000), size: 1114112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\kernel32.dll', fileVersion: 6.1.7601.19110
C:\Windows\syswow64\KERNELBASE.dll:KERNELBASE.dll (75C40000), size: 290816 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\KERNELBASE.dll', fileVersion: 6.1.7601.19110
C:\Windows\system32\MSVBVM60.DLL:MSVBVM60.DLL (72940000), size: 1388544 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MSVBVM60.DLL', fileVersion: 6.0.98.15
C:\Windows\syswow64\USER32.dll:USER32.dll (75280000), size: 1048576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\USER32.dll', fileVersion: 6.1.7601.19061
C:\Windows\syswow64\GDI32.dll:GDI32.dll (75880000), size: 589824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\GDI32.dll', fileVersion: 6.1.7601.19091
C:\Windows\syswow64\LPK.dll:LPK.dll (76D80000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\LPK.dll', fileVersion: 6.1.7601.18985
C:\Windows\syswow64\USP10.dll:USP10.dll (755A0000), size: 643072 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\USP10.dll', fileVersion: 1.626.7601.19054
C:\Windows\syswow64\msvcrt.dll:msvcrt.dll (75030000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\msvcrt.dll', fileVersion: 7.0.7601.17744
C:\Windows\syswow64\ADVAPI32.dll:ADVAPI32.dll (74BD0000), size: 659456 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\ADVAPI32.dll', fileVersion: 6.1.7601.19091
C:\Windows\SysWOW64\sechost.dll:sechost.dll (74CA0000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SysWOW64\sechost.dll', fileVersion: 6.1.7601.18869
C:\Windows\syswow64\RPCRT4.dll:RPCRT4.dll (75760000), size: 983040 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\RPCRT4.dll', fileVersion: 6.1.7601.19110
C:\Windows\syswow64\SspiCli.dll:SspiCli.dll (74B70000), size: 393216 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SspiCli.dll', fileVersion: 6.1.7601.19110
C:\Windows\syswow64\CRYPTBASE.dll:CRYPTBASE.dll (74B60000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CRYPTBASE.dll', fileVersion: 6.1.7601.19110
C:\Windows\syswow64\ole32.dll:ole32.dll (75C90000), size: 1425408 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\ole32.dll', fileVersion: 6.1.7601.18915
C:\Windows\syswow64\OLEAUT32.dll:OLEAUT32.dll (75640000), size: 585728 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\OLEAUT32.dll', fileVersion: 6.1.7601.18679
C:\Windows\system32\apphelp.dll:apphelp.dll (71250000), size: 311296 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\apphelp.dll', fileVersion: 6.1.7601.19050
C:\Windows\AppPatch\AcLayers.DLL:AcLayers.DLL (6E470000), size: 577536 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\AppPatch\AcLayers.DLL', fileVersion: 6.1.7601.19050
C:\Windows\syswow64\SHELL32.dll:SHELL32.dll (75E50000), size: 12890112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SHELL32.dll', fileVersion: 6.1.7601.19135
C:\Windows\syswow64\SHLWAPI.dll:SHLWAPI.dll (75700000), size: 356352 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SHLWAPI.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\USERENV.dll:USERENV.dll (74C80000), size: 94208 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\USERENV.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\profapi.dll:profapi.dll (74F40000), size: 45056 (result: 0), SymType: '-nosymbols-', PDB: 'C:\Windows\syswow64\profapi.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\WINSPOOL.DRV:WINSPOOL.DRV (712A0000), size: 331776 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WINSPOOL.DRV', fileVersion: 6.1.7601.17514
C:\Windows\system32\MPR.dll:MPR.dll (73710000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MPR.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\IMM32.DLL:IMM32.DLL (75DF0000), size: 393216 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\IMM32.DLL', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\MSCTF.dll:MSCTF.dll (74F50000), size: 835584 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\MSCTF.dll', fileVersion: 6.1.7601.18731
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\LunaDll.dll:LunaDll.dll (592C0000), size: 2936832 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\LunaDll.dll', fileVersion: 0.7.3.0
C:\Windows\system32\VERSION.dll:VERSION.dll (731A0000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\VERSION.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\WINMM.dll:WINMM.dll (72F40000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WINMM.dll', fileVersion: 6.1.7601.17514
C:\Windows\system32\dbghelp.dll:dbghelp.dll (707F0000), size: 962560 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\dbghelp.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\WS2_32.dll:WS2_32.dll (75C00000), size: 217088 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\WS2_32.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\NSI.dll:NSI.dll (771E0000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\NSI.dll', fileVersion: 6.1.7600.16385
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\SDL2.dll:SDL2.dll (6C740000), size: 4296704 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\SDL2.dll', fileVersion: 2.0.3.0
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\SDL2_mixer_ext.dll:SDL2_mixer_ext.dll (66380000), size: 2465792 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\SDL2_mixer_ext.dll'
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libgcc_s_dw2-1.dll:libgcc_s_dw2-1.dll (6E940000), size: 147456 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libgcc_s_dw2-1.dll'
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libwinpthread-1.dll:libwinpthread-1.dll (64940000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libwinpthread-1.dll', fileVersion: 1.0.0.0
C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libstdc++-6.dll:libstdc++-6.dll (6FC40000), size: 1052672 (result: 0), SymType: '-exported-', PDB: 'C:\Users\Daniel\Desktop\SMBX-2.0 Open Beta\libstdc++-6.dll'
C:\Windows\system32\OPENGL32.dll:OPENGL32.dll (591F0000), size: 819200 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\OPENGL32.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\GLU32.dll:GLU32.dll (591C0000), size: 139264 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\GLU32.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\DDRAW.dll:DDRAW.dll (02D40000), size: 946176 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DDRAW.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\DCIMAN32.dll:DCIMAN32.dll (6FB90000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DCIMAN32.dll', fileVersion: 6.1.7601.18985
C:\Windows\syswow64\SETUPAPI.dll:SETUPAPI.dll (750E0000), size: 1691648 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SETUPAPI.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\CFGMGR32.dll:CFGMGR32.dll (76DE0000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CFGMGR32.dll', fileVersion: 6.1.7601.17621
C:\Windows\syswow64\DEVOBJ.dll:DEVOBJ.dll (75850000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\DEVOBJ.dll', fileVersion: 6.1.7601.17621
C:\Windows\system32\dwmapi.dll:dwmapi.dll (6FED0000), size: 77824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\dwmapi.dll', fileVersion: 6.1.7601.18917
C:\Windows\system32\MSIMG32.dll:MSIMG32.dll (6FF70000), size: 20480 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MSIMG32.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL:api-ms-win-core-synch-l1-2-0.DLL (67DF0000), size: 12288 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL', fileVersion: 10.0.10240.16390
C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll:tiptsf.dll (73430000), size: 360448 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll', fileVersion: 6.1.7601.18984
C:\Windows\system32\atiglpxx.dll:atiglpxx.dll (67DE0000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\atiglpxx.dll', fileVersion: 8.14.1.6214
C:\Windows\system32\atioglxx.dll:atioglxx.dll (69030000), size: 18362368 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\atioglxx.dll', fileVersion: 6.14.10.10834
C:\Windows\system32\atigktxx.dll:atigktxx.dll (591B0000), size: 45056 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\atigktxx.dll', fileVersion: 8.14.1.6214
C:\Windows\system32\aticfx32.dll:aticfx32.dll (5C4A0000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\aticfx32.dll', fileVersion: 8.17.10.1083
C:\Windows\system32\atiadlxy.dll:atiadlxy.dll (10000000), size: 262144 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\atiadlxy.dll', fileVersion: 6.14.10.1061
C:\Windows\system32\WTSAPI32.dll:WTSAPI32.dll (71A40000), size: 53248 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WTSAPI32.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\PSAPI.DLL:PSAPI.DLL (75910000), size: 20480 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\PSAPI.DLL', fileVersion: 6.1.7600.16385
C:\Windows\syswow64\WINTRUST.dll:WINTRUST.dll (76D90000), size: 192512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\WINTRUST.dll', fileVersion: 6.1.7601.18839
C:\Windows\syswow64\CRYPT32.dll:CRYPT32.dll (74CC0000), size: 1183744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CRYPT32.dll', fileVersion: 6.1.7601.18839
C:\Windows\syswow64\MSASN1.dll:MSASN1.dll (76AA0000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\MSASN1.dll', fileVersion: 6.1.7601.17514
C:\Windows\system32\SXS.DLL:SXS.DLL (6BE10000), size: 389120 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\SXS.DLL', fileVersion: 6.1.7601.17514
C:\Windows\system32\asycfilt.dll:asycfilt.dll (59160000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\asycfilt.dll', fileVersion: 6.1.7601.17514
C:\Windows\syswow64\CLBCatQ.DLL:CLBCatQ.DLL (754F0000), size: 536576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CLBCatQ.DLL', fileVersion: 2001.12.8530.16385
C:\Windows\system32\oleacc.dll:oleacc.dll (711D0000), size: 245760 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\oleacc.dll', fileVersion: 7.0.0.0
C:\Windows\system32\DINPUT.DLL:DINPUT.DLL (56E30000), size: 151552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DINPUT.DLL', fileVersion: 6.1.7600.16385
C:\Windows\system32\HID.DLL:HID.DLL (70E80000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\HID.DLL', fileVersion: 6.1.7600.16385
C:\Windows\system32\DSOUND.DLL:DSOUND.DLL (59590000), size: 466944 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DSOUND.DLL', fileVersion: 6.1.7600.16385
C:\Windows\system32\POWRPROF.dll:POWRPROF.dll (74810000), size: 151552 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\POWRPROF.dll', fileVersion: 6.1.7600.16385
C:\Windows\System32\MMDevApi.dll:MMDevApi.dll (6CE30000), size: 233472 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\MMDevApi.dll', fileVersion: 6.1.7601.17514
C:\Windows\System32\PROPSYS.dll:PROPSYS.dll (703D0000), size: 1003520 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\PROPSYS.dll', fileVersion: 7.0.7601.17514
C:\Windows\system32\AUDIOSES.DLL:AUDIOSES.DLL (6CDF0000), size: 221184 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\AUDIOSES.DLL', fileVersion: 6.1.7601.18741
C:\Windows\system32\wdmaud.drv:wdmaud.drv (67E30000), size: 196608 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wdmaud.drv', fileVersion: 6.1.7601.17514
C:\Windows\system32\ksuser.dll:ksuser.dll (71030000), size: 16384 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\ksuser.dll', fileVersion: 6.1.7601.19091
C:\Windows\system32\AVRT.dll:AVRT.dll (71020000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\AVRT.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\msacm32.drv:msacm32.drv (70BC0000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\msacm32.drv', fileVersion: 6.1.7600.16385
C:\Windows\system32\MSACM32.dll:MSACM32.dll (6D010000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MSACM32.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\midimap.dll:midimap.dll (6D000000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\midimap.dll', fileVersion: 6.1.7600.16385
C:\Windows\system32\CRYPTSP.dll:CRYPTSP.dll (70B30000), size: 94208 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\CRYPTSP.dll', fileVersion: 6.1.7601.18741
C:\Windows\system32\rsaenh.dll:rsaenh.dll (71210000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\rsaenh.dll', fileVersion: 6.1.7600.16385


**** THE STACKTRACE ****
0: 5935BB0F (LunaDll): (filename not available): LunaLuaGlDrawTriangles
1: 59370429 (LunaDll): (filename not available): LunaLuaGlDrawTriangles
2: 592FE66A (LunaDll): (filename not available): LunaLuaGlDrawTriangles
3: 5932F2AC (LunaDll): (filename not available): LunaLuaGlDrawTriangles
4: 592C27FA (LunaDll): (filename not available): (function-name not available)
5: 593F58B6 (LunaDll): (filename not available): LunaLuaGlDrawTriangles
6: 592C9131 (LunaDll): (filename not available): (function-name not available)
7: 592C972B (LunaDll): (filename not available): (function-name not available)
8: 592CA612 (LunaDll): (filename not available): (function-name not available)
9: 592CA2FC (LunaDll): (filename not available): (function-name not available)
10: 00A755D7 (smbx.exe): (filename not available): (function-name not available)
11: 008CA24F (smbx.exe): (filename not available): (function-name not available)
12: 008C224A (smbx.exe): (filename not available): (function-name not available)
13: 7294A048 (MSVBVM60): (filename not available): EbLoadRunTime
14: 72947B3E (MSVBVM60): (filename not available): BASIC_CLASS_QueryInterface
15: 72943981 (MSVBVM60): (filename not available): ThunRTMain
16: 729436FA (MSVBVM60): (filename not available): ThunRTMain
17: 72943600 (MSVBVM60): (filename not available): ThunRTMain
18: 0040BDE2 (smbx.exe): (filename not available): (function-name not available)
19: 77249882 (ntdll): (filename not available): RtlInitializeExceptionChain
20: 77249855 (ntdll): (filename not available): RtlInitializeExceptionChain
What am I doing wrong?
Last edited by PixelPest on Fri Mar 18, 2016 11:42 am, edited 1 time in total.

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

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Fri Mar 18, 2016 11:40 am

PixelPest wrote:Okay. Here's what I've done now:

Code: Select all

storedpower = false
change = false
canchange = false

function onTick()
	if player.powerup ~= PLAYER_SMALL or player.powerup ~= PLAYER_BIG then
		storedpower = true
	end
   
	if player.powerup == PLAYER_SMALL then
		if storedpower == true then
			change = true
			storedpower = false
		end
	end
	
	if change == true and canchange == true then
		player.powerup = PLAYER_BIG
	end
	
	while mem(0x122,FIELD_WORD ) == 2 do
		canchange = false
	end
end
But I'm getting this crash and error report each time:
That's not how while loops work. While loops are executed x times each frame where x is how often this condition is met.
You can make this code a lot shorter by just checking for the mem value when trying to set the player powerup to big.
The ABC of Creation
________________________________________________________
Image

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Mar 18, 2016 11:45 am

Okay thanks. Fixed it. Going to post it in the helpful codes thread

User avatar
Nat The Porcupine
Swooper
Swooper
Posts: 122
Joined: Tue Nov 10, 2015 2:55 pm
Current Project: Nothing ATM

Re: Need help with lua? - LunaLua General Help

Postby Nat The Porcupine » Fri Mar 18, 2016 12:48 pm

How would I go about reading data from custom .ini files? I'm writing an API that allows customization of player animations & I wanted to be able to read the customized animation data out of player .ini files generated by PGE Character Calibrator. Currently, you can only load hitbox data from those files, and I want to change that. Thanks in advance!

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Fri Mar 18, 2016 1:55 pm

Is that possible to give characters abilities (like Wario has) for example double jump only for Luigi, something else for Mario, Toad and Peach?
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Mar 18, 2016 2:12 pm

Nat The Porcupine wrote:How would I go about reading data from custom .ini files? I'm writing an API that allows customization of player animations & I wanted to be able to read the customized animation data out of player .ini files generated by PGE Character Calibrator. Currently, you can only load hitbox data from those files, and I want to change that. Thanks in advance!
You might want to reconsider doing this. There's already playAnim that will be released with the next version of 2.0
Mario_and_Luigi_55 wrote:Is that possible to give characters abilities (like Wario has) for example double jump only for Luigi, something else for Mario, Toad and Peach?
http://wohlsoft.ru/pgewiki/LunaLua_constants http://wohlsoft.ru/pgewiki/Player_(class)
Last edited by PixelPest on Sat Mar 19, 2016 7:04 am, edited 1 time in total.

User avatar
Nat The Porcupine
Swooper
Swooper
Posts: 122
Joined: Tue Nov 10, 2015 2:55 pm
Current Project: Nothing ATM

Re: Need help with lua? - LunaLua General Help

Postby Nat The Porcupine » Fri Mar 18, 2016 2:29 pm

PixelPest wrote:You might want to reconsider doing this. There's already playAnim that will be released with the next version of 2.0
Oh, OK. That's actually a really good thing. Turns out LunaLua doesn't have access to Lua's io library, so I would have needed to find a workaround. Anyways, thanks for the info.

Hmm... Now that an API for that exists, what should I do for my first API?

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Mar 18, 2016 2:47 pm

Choose something simple, in fact, try this:

Create an API called "xlotus.lua", or something along that line that does the following:
1. Change the lotus's fire to a different NPC for the duration of a level (you choose, try a boo, mushroom, etc.)
2. Allow the player to select what NPC that is (through their lunadll.lua), and make sure the API compensates for any NPC (fire flower, Wart, rinka, etc.)

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1210
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Mar 18, 2016 5:43 pm

Nat The Porcupine wrote:Turns out LunaLua doesn't have access to Lua's io library
This is actually just blatantly false. I've used Lua's IO library in a number of libraries. Particles, for example, relies on it.

User avatar
Nat The Porcupine
Swooper
Swooper
Posts: 122
Joined: Tue Nov 10, 2015 2:55 pm
Current Project: Nothing ATM

Re: Need help with lua? - LunaLua General Help

Postby Nat The Porcupine » Fri Mar 18, 2016 6:05 pm

Hoeloe wrote:
Nat The Porcupine wrote:Turns out LunaLua doesn't have access to Lua's io library
This is actually just blatantly false. I've used Lua's IO library in a number of libraries. Particles, for example, relies on it.
oh... Kevsoft didn't list that in the official thread though.

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

Re: Need help with lua? - LunaLua General Help

Postby Kevsoft » Fri Mar 18, 2016 6:34 pm

Nat The Porcupine wrote:
Hoeloe wrote:
Nat The Porcupine wrote:Turns out LunaLua doesn't have access to Lua's io library
This is actually just blatantly false. I've used Lua's IO library in a number of libraries. Particles, for example, relies on it.
oh... Kevsoft didn't list that in the official thread though.
I know that I have to restructor the thread to be more up to date.

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Sat Mar 19, 2016 6:29 am

Mario_and_Luigi_55 wrote:Is that possible to give characters abilities (like Wario has) for example double jump only for Luigi, something else for Mario, Toad and Peach?
http://wohlsoft.ru/pgewiki/LunaLua_constants http://wohlsoft.ru/pgewiki/Player_(class)[/quote]


Thank you!

I have two more questions

1. Is there a way to make player run faster?

2. Is there a way to make an enemy kill player instantly?
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sat Mar 19, 2016 7:30 am

1. You would use player.speedx, but you would need to relate the new speed to the old speed of the player. For example, if I wanted to make the player run twice as fast:

Code: Select all

function onInputUpdate()
    if player.rightkeypressing then
        local normal = player.speedx
        player.speedx = player.speedx*2
        normal = normal/2
    end
    if player.leftKeyPressing then
        player.speedx = player.speedx*2
        normal = normal/2
    end
    ...
end 
2. You can use NPC.id to find the NPC, NPC.getInterecting(player.x, player.y,...) to find if it's intersecting the player, and then player:kill()

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Sat Mar 19, 2016 7:32 am

PixelPest wrote:1. You would use player.speedx, but you would need to relate the new speed to the old speed of the player. For example, if I wanted to make the player run twice as fast:

Code: Select all

function onInputUpdate()
    if player.rightkeypressing then
        local normal = player.speedx
        player.speedx = player.speedx*2
        normal = normal/2
    end
    if player.leftKeyPressing then
        player.speedx = player.speedx*2
        normal = normal/2
    end
    ...
end 
2. You can use NPC.id to find the NPC, NPC.getInterecting(player.x, player.y,...) to find if it's intersecting the player, and then player:kill()
Thanks
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1210
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Sat Mar 19, 2016 7:33 am

PixelPest wrote:1. You would use player.speedx, but you would need to relate the new speed to the old speed of the player. For example, if I wanted to make the player run twice as fast:
It's worth noting that this is not a complete solution. This doesn't take into account things like moving layers, which WILL break if you use this kind of code.

Also, if you want to simplify the NPC collision code you can just do:

Code: Select all

if colliders.collideNPC(player,INSERTNPCID) then
    player:kill();
end

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sat Mar 19, 2016 7:35 am

Thanks for noticing that Hoeloe. Also, you'd have to do local colliders = API.load("colliders") to use the code you provided, right?

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Sat Mar 19, 2016 9:04 am

Invalid player-pointer. Help:

Code: Select all

-- Loads Bowser
local bowser = loadAPI("bowser") 
local odlicz = 400

-- Loads Luigi's double jump
local ileskokow = 2; 
local licznikskokow = ileskokow;
if player.character == 2 then
function onLoop()
   if player:mem(0x146,FIELD_WORD) == 2 then
      licznikskokow = ileskokow;
   end
end
function onKeyDown(keycode)
   if keycode == KEY_JUMP and licznikskokow > 0 then
      playSFX(1)
      licznikskokow = licznikskokow - 1;
      player.speedY = -10;
   end
end
end

-- loads Mario's fast fall and bonus coins
if player.character == 1 then
function onKeyDown(keycode)
	if keycode==KEY_DOWN then
			player.speedY = 10
	end
end
end
	
	
if player.character == 1 then 
function onLoop()
odlicz = odlicz-1
if odlicz==0 or odlicz<0 then
		mem(0x00B2C5A8,FIELD_WORD,mem(0x00B2C5A8,FIELD_WORD)+1)
		odlicz = 400
end
end
end
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

User avatar
snoruntpyro
Pokey
Pokey
Posts: 223
Joined: Sun Oct 11, 2015 9:36 am
Contact:

Re: Need help with lua? - LunaLua General Help

Postby snoruntpyro » Sat Mar 19, 2016 9:35 am

You put an "if player.character == 2" outside of all of the functions. You can't do that, conditions like that have to be in stuff like onLoop, onTick, onKeyDown, etc.
Spoiler: show
Image
Spoiler: show
Image

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Sat Mar 19, 2016 9:53 am

snoruntpyro wrote:You put an "if player.character == 2" outside of all of the functions. You can't do that, conditions like that have to be in stuff like onLoop, onTick, onKeyDown, etc.

OK. So now I have that and nothing works except of Mario's fast falling

Code: Select all

local odlicz=400 

-- Loads Luigi's double jump
local ileskokow = 2; 
local licznikskokow = ileskokow;
function onLoop()
   if player:mem(0x146,FIELD_WORD) == 2 then
      licznikskokow = ileskokow;
   end
end
function onKeyDown(keycode)
   if keycode == KEY_JUMP and licznikskokow > 0 and player.character == CHARACTER_LUIGI then
      playSFX(1)
      licznikskokow = licznikskokow - 1;
      player.speedY = -10;
   end
end

-- loads Mario's fast fall and bonus coins
function onKeyDown(keycode)
	if keycode==KEY_DOWN then
		if  player.character == CHARACTER_MARIO then
			player.speedY = 10
		end
	end
end
	
	
function onLoop()
odlicz = odlicz-1
if odlicz==0 or odlicz<0 then
	if  player.character == CHARACTER_MARIO then
		mem(0x00B2C5A8,FIELD_WORD,mem(0x00B2C5A8,FIELD_WORD)+1)
		odlicz = 400
	end
end
end
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

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

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Mar 19, 2016 10:15 am

You can only have one function of each name in your lunadll.lua file.
Also, maximum player fall speed is 12, so even if it worked, it wouldn't be noticable if the player was already falling.
The ABC of Creation
________________________________________________________
Image


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests