Posts for muxum

Post subject: energy bar lua
Experienced Forum User
Joined: 5/20/2008
Posts: 10
secret of mana - bars selects treasures with a + and shows a bar for all players and enemies. the count of layers on the bar (1-8) can be changed by holding start and pressing left/right http://mitglied.lycos.de/muxum/secret%20of%20mana%20-%20bars.lua http://www.mediafire.com/?2lxvyaclyna
Experienced Forum User
Joined: 5/20/2008
Posts: 10
try youtube or simmilar video sites for time records
Experienced Forum User
Joined: 5/20/2008
Posts: 10
here something to easy configure key combination on which a function is called. supports down, pressed and released behaviours joyp.lua :

--[[
joyp api by Xyrio/muxum

allows easy configuration of key combinations on which a function is called

version 0.1
lua 5.1+
]]

KEYSTATE = { UP=nil, DOWN=1, PRESSED=2, RELEASED=3 } --UP is so u know that all key reulting to nil r interpreted as having to be UP
--used to check all available keys
KEYLIST = { L=0, R=1, A=2, B=3, X=4, Y=5, start=6, select=7, up=8, down=9, left=10, right=11 }

--- joypad states with up=nil and notup = not nil joypad states (total 5 joypads)
keysold = { [1]={}, [2]={}, [3]={}, [4]={}, [5]={} }
keysnew = { [1]={}, [2]={}, [3]={}, [4]={}, [5]={} }

--- key combination list and their action
--- list item is a table like: { padnr=1, action=function() end, keys={ L=KEYSTATE.DOWN, R=KEYSTATE.PRESSED } } -- hold L and press R to trigger
--- note: index of keycombs can be anything
keycombs = {}

joyp = {}

--- key is down in current frame
--- returns nil on false else true
joyp.isDown = function(keymap,padnr,key)
	if padnr ~= nil and keymap[padnr][key] ~= nil then 
		return true
	end
end
--- key is down in current frame
--- returns nil on false else true
joyp.isUp = function(keymap,padnr,key)
	if padnr ~= nil and keymap[padnr][key] == nil then 
		return true
	end
end
--- key down this frame and was up last frame
--- returns nil on false else true
joyp.isPressed = function(for_interface_but_unused,padnr,key)
	if joyp.isDown(keysnew,padnr,key) and joyp.isUp(keysold,padnr,key) then
		return true
	end
end
--- key up this frame and was down last frame
--- returns nil on false else true
joyp.isReleased = function(for_interface_but_unused,padnr,key)
	if joyp.isUp(keysnew,padnr,key) and joyp.isDown(keysold,padnr,key) then
		return true
	end
end

joyp.getAllPadsKeys = function()
	local keys = {}
	keys[1] = joypad.read(1)
	keys[2] = joypad.read(2)
	keys[3] = joypad.read(3)
	keys[4] = joypad.read(4)
	keys[5] = joypad.read(5)
	return keys
end
--- to be called in mainloop
joyp.handleInput = function()
	local switch_keystate = { [KEYSTATE.DOWN]=joyp.isDown, [KEYSTATE.PRESSED]=joyp.isPressed, [KEYSTATE.RELEASED]=joyp.isReleased }
	keysnew = joyp.getAllPadsKeys()
	for i,kcomb in pairs(keycombs) do --for all key combinations
		local alltrue = true
		for key in pairs(KEYLIST) do -- for all possible keys
			if kcomb.keys[key] ~= nil then
				if switch_keystate[kcomb.keys[key]](keysnew,kcomb.padnr,key) == nil then
					alltrue = false
				end
			else
				if joyp.isUp(keysnew,kcomb.padnr,key) == nil then
					alltrue = false
				end
			end
		end
		if alltrue == true and kcomb.action ~= nil then
			kcomb.action()
		end
	end
	keysold = keysnew
end
and here an example of how you could use it: show mana - hold start and press select next weapon of same type (needs reequip to apply weapon stats) - hold start and press up prev weapon of same type (needs reequip to apply weapon stats) - hold start and press down weapon has polymorph status (changed enemy type on hit) - hold start and press L infinite stamina/ at least 100% weapon attacks - hold start and press R (script for that behaviour is in the download) one line from a file inside the download as an example how u config key combinations:
...
keycombs["showmana"] = { padnr=1, action=function() ui.flags.mana = toggle(ui.flags.mana) end, keys={ start=KEYSTATE.DOWN, select=KEYSTATE.PRESSED } } -- show mana values on screen
...
here everything for download: http://www.mediafire.com/?bbkwjy3xjy5
Experienced Forum User
Joined: 5/20/2008
Posts: 10
you can run several scripts easy by adding
dofile("file.lua")
to your main lua file (the one u load in snes9x_lua) before u use stuff from that file or if u just want that script to be executed. but u should have only one (main) while loop in all those files together.
Experienced Forum User
Joined: 5/20/2008
Posts: 10
nitsujrehtona wrote:
Would a few "script control" hotkeys (and the abuse of, say, controllers #3-#5) be enough for your purposes?
pads 1-5 can already be accessed but only the snes keys like A B X Y... what i ment r keys not maped to a snes key that one could use. keys not addressed as ABXY.. but sometihing like the button with number and the axis with number and direction: Buttons -> B0,B1,B2... value: nil or true Axes -> A0X, A0Y value: nil or (+/-)number or Axes -> A0XP, A0XN (P=positive N=negative) value: nil or true (this would suffice too. dunno to what extent a +/- number is supported by snes and thus snes emus)
Post subject: how to extend snes9x_lua with existing libraries
Experienced Forum User
Joined: 5/20/2008
Posts: 10
how to extend snes9x lua without changing snes9x: find a library u want to use for example: http://nmap.org/book/nse-library.html checkout the Bitwise Logical Operations part dowload the library (http://nmap.org/dist/nmap-4.62-win32.zip inside ...bin folder u find the dll) move the libraryname.dll to your snes9x (which uses lua) folder to use it write require "libraryname" before u actually use parts of it in this example:
require "bit"

while true do
	gui.text(0,0,bit.band(2,6))
	snes9x.frameadvance()
end
Experienced Forum User
Joined: 5/20/2008
Posts: 10
regarding input: it would be nicer to have full joypad access (if you have a joypad with 10 buttons 4 axes...) not only the snes keys because those r usually already used by the game and keyboard input would be nice too really usefull would be to have at least a "file > reload last lua script" menu option which reloads last loaded script (no matter if it had errors last time or not). better if it that call had a keyboard key configed to it. even better if the key(keyb or joyp) could be chosen by oneself (although pads 2-5 if unused in game can be misused for keyboard input)
Post subject: Memory Organizer for snes9x
Experienced Forum User
Joined: 5/20/2008
Posts: 10
http://mitglied.lycos.de/muxum/memorg/ this is a Trainer (early stage alpha version) that uses game monkey scripts to set addresses, read/write behaviour, fill the list... it includes 2 scripts for zsnes 1.51/1.42 and secret of mana/evermore. those who play those games might want to use it as it includes several codes already. for Snes9x 1.51 (offizial) add this to line 10 of both secret_of_mana.gm and secret_of_evermore.gm files in the scripts directory ADDRDIFF[2]=13285576; edEmus[2]="Snes9x 1.51"; proc[2] = "snes9x.exe"; im also interested in similar programs u know. something also in the direction of scriptable trainers especially those who have similar editor behaviour to Memory Organizer (using combos,checkboxes...,trees to show data) i am the dev of MemOrg so if you have ideas what to add to my todo list... but note that im lazy and updates could take long ps: ive already seen the memory watcher in this forum. it remembered me having MemOrg
Experienced Forum User
Joined: 5/20/2008
Posts: 10
do u use the platform sdk with vcexpress? the last error may be because vcexpress is lacking headers/code present in the normal vc versions. using platform sdk u still dont get everything but way better than without as i may not read this too soon again there a how to -> http://msdn.microsoft.com/en-us/express/aa700755.aspx lol omg just saw its over half a year old post damn
Experienced Forum User
Joined: 5/20/2008
Posts: 10
hope movie.open gets added to 0.07 so i can try amaurea's ghost script :)