This commit is contained in:
p.kosyh 2010-05-19 17:38:09 +00:00
parent 658c28538a
commit 53701da01c
2 changed files with 519 additions and 511 deletions

View file

@ -325,7 +325,7 @@ knife = obj {
inv = 'Sharp!',
tak = 'I took the knife!',
use = function(s, w)
if w ~= 'tabl'
if w ~= 'tabl' then
return 'I don\'t want to cut this.', false
else
return 'You incise your initials on the table.';
@ -591,7 +591,7 @@ You can pass from one dialog to another, organizing hierarchic dialogs.
You can also hide some phrases when initializing the dialog and show them under certain conditions.
<code>
facectrl = dlg {
nam = 'фэйсконтроль',
nam = 'facecontrol',
dsc = 'I see an unpleasant face of a fat guard.',
obj = {
[1] = phr('“I came to the Belin's lecture...”',
@ -649,7 +649,7 @@ There is a modification of “vobj” object — “vway”. It creates a refere
You can dynamically fill the scene with “vobj” and “vway” objects. Use methods “add” and “del”. For example:
<code>
home.objs:add(vway("next", "{Next}.", 'next_room');
home.objs:add(vway("next", "{Next}.", 'next_room'));
-- some code here
home.objs:del("next");
</code>
@ -877,6 +877,7 @@ If you use “goto” from the “exit” handler, you get stack overflow, becau
exit = function(s, t)
if t == 'dialog' then return; end
return goto('dialog');
end
</code>
From version 0.9.1 this is done by stead engine.
@ -937,11 +938,11 @@ You can create a game with several characters and switch between them from time
==== Using the first parameter of a handler ====
Code example.
<code>
knife = obj {
stone = obj {
nam = 'stone',
dsc = 'There is a {stone} at the edge.',
act = function()
objs():del('knife');
objs():del('stone');
return 'I pushed the stone, it fell and flew down...';
end
</code>
@ -962,7 +963,7 @@ You can write your own music player, creating it from a live object, e.g:
-- plays tracks in random order, starting from 2-nd
tracks = {"mus/astro2.mod", "mus/aws_chas.xm", "mus/dmageofd.xm", "mus/doomsday.s3m"}
mplayer = obj {
nam = 'плеер',
nam = 'media player',
life = function(s)
local n = get_music();
local v = get_music_loop();
@ -1175,6 +1176,8 @@ end
</code>
''pn()'' function adds line feed to the text and outputs the result to the buffer. ''p()'' does almost the same thing but adds a space instead of line feed.
There is a function ''pr()'' in versions 1.1.6 and later, that does not add anything at end of output.
To clear the buffer you can use ''pclr()''. To return the status of the action along with the text, use ''pget()''.
<code>
use = function(s, w)

View file

@ -323,7 +323,7 @@ knife = obj {
inv = 'Острый!',
tak = 'Я взял нож!',
use = function(s, w)
if w ~= 'tabl'
if w ~= 'tabl' then
return 'Не хочу это резать.', false
else
return 'Вы вырезаете на столе свои инициалы.';
@ -644,8 +644,8 @@ sside = room {
Вы можете динамически заполнять сцену объектами vobj или vway с помощью методов add и del. Например:
<code>
home.objs:add(vway("next", "{Дальше}.", 'next_room');
-- some code here
home.objs:add(vway("next", "{Дальше}.", 'next_room'));
-- здесь какой-нибудь код
home.objs:del("next");
</code>
@ -664,11 +664,11 @@ mycat = obj {
nam = 'Барсик',
lf = {
[1] = 'Барсик шевелится у меня за пазухой.',
[2] = 'Барсик выглядывает из за пазухи.',
[2] = 'Барсик выглядывает из-за пазухи.',
[3] = 'Барсик мурлычит у меня за пазухой.',
[4] = 'Барсик дрожит у меня за пазухой.',
[5] = 'Я чувствую тепло Барсика у себя за пазухой.',
[6] = 'Барсик высовывает голову из за пазухи и осматривает местность.',
[6] = 'Барсик высовывает голову из-за пазухи и осматривает местность.',
},
life = function(s)
local r = rnd(6);
@ -863,6 +863,7 @@ inv():add('status');
exit = function(s, t)
if t == 'dialog' then return; end
return goto('dialog');
end
</code>
Начиная с версии 0.9.1 движок сам разрывает рекурсию.
@ -922,11 +923,11 @@ doencfile("game");
==== Использование первого параметра обработчика ====
Пример кода.
<code>
knife = obj {
stone = obj {
nam = 'камень',
dsc = 'На краю лежит {камень}.',
act = function()
objs():del('knife');
objs():del('stone');
return 'Я толкнул камень, он сорвался и улетел вниз...';
end
</code>
@ -938,6 +939,7 @@ knife = obj {
return 'Я толкнул камень, он сорвался и улетел вниз...';
end
</code>
==== Использование set_music ====
Вы можете использовать set_music для проигрывания звуков, задавая второй параметр -- счетчик циклов проигрывания звукового файла.
@ -1004,6 +1006,7 @@ horse = obj {
};
lifeon('horse');
</code>
==== Таймер ====
Начиная с версии 1.1.0 в instead появлилась возможность использовать таймер. (Только в графической версии интерпретатора.)
@ -1067,7 +1070,7 @@ main = room {
input.click(s, pressed, mb, x, y, px, py) -- обработчик клика мыши; pressed -- нажатие или отжатие. mb -- номер кнопки (1 - левая), x и y -- координаты клика относительно левого верхнего угла. px и py присутствуют, если клик произошел в области картинки сцены и содержит координаты клика относительно левого верхнего угла картинки.
Обработчик может вернуть команду интерфейса stead, в этом случае клик не будет обработана интерпретатором.
Обработчик может вернуть команду интерфейса stead, в этом случае клик не будет обработан интерпретатором.
Например:
<code>
@ -1158,6 +1161,8 @@ end
</code>
Функция pn() выполняет вывод текста в буфер, дополняя его переводом строки. Функция p() дополняет вывод пробелом.
Начиная с версии 1.1.6 существует функция pr(), которая не выполняет дополнение вывода.
Для очистки буфера, используйте pclr(). Если вам нужно вернуть статус действия, используйте pget().
<code>
use = function(s, w)