dbg module added

This commit is contained in:
p.kosyh 2010-06-14 11:54:21 +00:00
parent f57e897c29
commit 6e12135af2
4 changed files with 19 additions and 12 deletions

2
debian/changelog vendored
View file

@ -12,7 +12,7 @@ instead (1.2.0) unstable; urgency=low
* hook and inherit;
* entered/left human friendly actions;
* stead.cmd, stead.args added;
* require added (modules: goto, xobj, input, click);
* require added (modules: goto, xobj, input, click, dbg);
* time of save slots;
* check_version added;
* taketo/takef added;

View file

@ -12,6 +12,7 @@ install:
$(INSTALL) xobj.lua $(STEADPATH)/xobj.lua
$(INSTALL) input.lua $(STEADPATH)/input.lua
$(INSTALL) click.lua $(STEADPATH)/click.lua
$(INSTALL) dbg.lua $(STEADPATH)/dbg.lua
uninstall:
$(RM) $(STEADPATH)/stead.lua

View file

@ -9,3 +9,4 @@ install:
copy xobj.lua ..\bin\stead
copy input.lua ..\bin\stead
copy click.lua ..\bin\stead
copy dbg.lua ..\bin\stead

View file

@ -3,6 +3,7 @@
-- for debug tools
choose_location = dlg {
debug = true,
forcedsc = true,
nam = 'Go to',
dsc = 'Select location.',
gen = function(s)
@ -11,15 +12,16 @@ choose_location = dlg {
for k,v in pairs(_G) do
if isRoom(v) and not v.debug then
local n = call(v, 'nam');
put(phr(n, nil, [[return goto("]]..k..[[")]]), s);
put(phr(n, true, [[return goto("]]..k..[[")]]), s);
end
end
put (phr('Exit',nil,'return back()'), s)
put (phr('Exit',true, 'return back()'), s)
end
}
choose_object = dlg {
debug = true,
forcedsc = true,
nam = 'Get object',
dsc = 'Select object to get.',
gen = function(s)
@ -28,15 +30,16 @@ choose_object = dlg {
for k,v in pairs(_G) do
if isObject(v) and not isRoom(v) and not isPlayer(v) and not v.debug and not have(v) and not isStatus(v) then
local n = call(v, 'nam');
put(phr(n, '', k..':enable(); return take("'..k..'")'), s);
put(phr(n, true, k..':enable(); return take("'..k..'")'), s);
end
end
put (phr('Exit',nil, 'return back()'), s)
put (phr('Exit',true, 'return back()'), s)
end
}
drop_object = dlg {
debug = true,
forcedsc = true,
nam = 'Drop object',
dsc = 'Select object to drop.',
gen = function(s)
@ -45,27 +48,29 @@ drop_object = dlg {
for k,v in pairs(_G) do
if isObject(v) and not isRoom(v) and not isPlayer(v) and not v.debug and have(v) then
local n = call(v, 'nam');
put (phr(k,'','drop("'..k..'","'..deref(from())..'")'), s)
put (phr(k, true, 'drop("'..k..'","'..deref(from())..'")'), s)
end
end
put (phr('Exit',nil, 'return back()'), s)
put (phr('Exit', true, 'return back()'), s)
end
}
debug_dlg = dlg {
debug = true,
debug = true,
forcedsc = true,
nam = 'Debug Tool',
dsc = 'Select tool.',
obj = {
[1]=phr('Go to location...', true ,[[pon(1); choose_location:gen(); return goto('choose_location')]]),
[2]=phr('Get object...', true , [[pon(2); choose_object:gen(); return goto('choose_object')]]),
[3]=phr('Put object...', true , [[pon(3); drop_object:gen(); return goto('drop_object')]]),
[4]=phr('Exit',nil , [[pon(4); return back()]]),
[1]=phr('Go to location...', true, [[pon(1); choose_location:gen(); return goto('choose_location')]]),
[2]=phr('Get object...', true, [[pon(2); choose_object:gen(); return goto('choose_object')]]),
[3]=phr('Put object...', true, [[pon(3); drop_object:gen(); return goto('drop_object')]]),
[4]=phr('Exit',true , [[pon(4); return goto(from())]]),
},
};
debug_tool = menu {
debug = true,
forcedsc = true,
nam = txtb('debug'),
inv = function(s)
debug_dlg.__from__ = deref(here());