2010-06-14 14:41:55 +03:00
|
|
|
-- add this: reuire "dbg"
|
|
|
|
-- in your project
|
|
|
|
-- for debug tools
|
|
|
|
choose_location = dlg {
|
|
|
|
debug = true,
|
2010-06-14 14:54:21 +03:00
|
|
|
forcedsc = true,
|
2010-06-14 14:41:55 +03:00
|
|
|
nam = 'Go to',
|
|
|
|
dsc = 'Select location.',
|
|
|
|
gen = function(s)
|
|
|
|
local k,v
|
|
|
|
objs(s):zap();
|
|
|
|
for k,v in pairs(_G) do
|
|
|
|
if isRoom(v) and not v.debug then
|
|
|
|
local n = call(v, 'nam');
|
2010-06-14 14:54:21 +03:00
|
|
|
put(phr(n, true, [[return goto("]]..k..[[")]]), s);
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
end
|
2010-06-14 14:54:21 +03:00
|
|
|
put (phr('Exit',true, 'return back()'), s)
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
choose_object = dlg {
|
|
|
|
debug = true,
|
2010-06-14 14:54:21 +03:00
|
|
|
forcedsc = true,
|
2010-06-14 14:41:55 +03:00
|
|
|
nam = 'Get object',
|
|
|
|
dsc = 'Select object to get.',
|
|
|
|
gen = function(s)
|
|
|
|
local k,v
|
|
|
|
objs(s):zap();
|
|
|
|
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');
|
2010-06-14 14:54:21 +03:00
|
|
|
put(phr(n, true, k..':enable(); return take("'..k..'")'), s);
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
end
|
2010-06-14 14:54:21 +03:00
|
|
|
put (phr('Exit',true, 'return back()'), s)
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
drop_object = dlg {
|
|
|
|
debug = true,
|
2010-06-14 14:54:21 +03:00
|
|
|
forcedsc = true,
|
2010-06-14 14:41:55 +03:00
|
|
|
nam = 'Drop object',
|
|
|
|
dsc = 'Select object to drop.',
|
|
|
|
gen = function(s)
|
|
|
|
local k,v
|
|
|
|
objs(s):zap();
|
|
|
|
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');
|
2010-06-14 14:54:21 +03:00
|
|
|
put (phr(k, true, 'drop("'..k..'","'..deref(from())..'")'), s)
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
end
|
2010-06-14 14:54:21 +03:00
|
|
|
put (phr('Exit', true, 'return back()'), s)
|
2010-06-14 14:41:55 +03:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
debug_dlg = dlg {
|
2010-06-14 14:54:21 +03:00
|
|
|
debug = true,
|
|
|
|
forcedsc = true,
|
2010-06-14 14:41:55 +03:00
|
|
|
nam = 'Debug Tool',
|
|
|
|
dsc = 'Select tool.',
|
|
|
|
obj = {
|
2010-06-14 14:54:21 +03:00
|
|
|
[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())]]),
|
2010-06-14 14:41:55 +03:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
debug_tool = menu {
|
|
|
|
debug = true,
|
2010-06-14 14:54:21 +03:00
|
|
|
forcedsc = true,
|
2010-06-14 14:41:55 +03:00
|
|
|
nam = txtb('debug'),
|
|
|
|
inv = function(s)
|
|
|
|
debug_dlg.__from__ = deref(here());
|
|
|
|
me().where = 'debug_dlg'; -- force to go
|
|
|
|
local r = call(debug_dlg, 'enter');
|
|
|
|
return r;
|
|
|
|
end
|
|
|
|
};
|
|
|
|
putf('debug_tool', me());
|