Изменения

Материал из Chaotic Onyx
Перейти к навигацииПерейти к поиску
3668 байт добавлено ,  23:30, 14 ноября 2015
Строка 9: Строка 9:  
=Глава 11=
 
=Глава 11=
   −
User Input/Output
+
Ввод\вывод Пользователя <!--User Input/Output-->
   −
Technology is the camp fire around which we narrate our stories.
+
Взаимодействие с пользователем - это главная цель любых программ в Dream Maker и эта глава описывает основы языка, отвечающего за ввод и вывод информации.  
--Laurie Anderson
+
<!--Interacting with the user is the ultimate purpose of any DM program. This chapter describes the elements of the language which make it possible. To come this far would have been impossible without a casual introduction to some of the input/output instructions, but even those have more power to offer.-->
Interacting with the user is the ultimate purpose of any DM program. This chapter describes the elements of the language which make it possible. To come this far would have been impossible without a casual introduction to some of the input/output instructions, but even those have more power to offer.
        −
==Input==
+
==Ввод==
   −
There are two basic ways of getting information from the player. One is client initiated and the other is server initiated input. The difference is in whether the player sends unsolicited input or whether the game asks for it. These will be discussed in the following sections.
+
Есть два основных пути получения информации от игрока. Первый - ввод по запросу клиента(игрока), второй - ввод по запросу сервера(игры). Разница в том, посылает ли игрок информацию на обработку, или игра запрашивает необходимую информацию.
 +
<!--There are two basic ways of getting information from the player. One is client initiated and the other is server initiated input. The difference is in whether the player sends unsolicited input or whether the game asks for it. These will be discussed in the following sections.-->
       
===Verbs===
 
===Verbs===
   −
All user input seen so far has come at the initiative of the user. The player may type a command, press a direction key, click an object, etc. These forms of input are all similar because they are ultimately handled by verbs. In the case of the direction keys and mouse clicks, players don't need to actually type any command--the client does it all. However, from the programmer's point of view, these are all the same: The player calls a procedure and possibly passes some arguments to it.
+
До сих пор весь ввод был со стороны пользователя. Игрок может написать команду, нажать кнопку управления, щёлкнуть на объект и т.д. Эти виды ввода информации однородны, так как ими управляют одинаковые операторы(verbs). То есть нажатие на кнопку влево вызывает определённый процесс и задаёт ему значение "кнопка влево".
 +
<!--All user input seen so far has come at the initiative of the user. The player may type a command, press a direction key, click an object, etc. These forms of input are all similar because they are ultimately handled by verbs. In the case of the direction keys and mouse clicks, players don't need to actually type any command--the client does it all. However, from the programmer's point of view, these are all the same: The player calls a procedure and possibly passes some arguments to it.-->
   −
The only pre-defined verbs are associated with the client data object. They are the direction keys (e.g. client.North()), mouse clicks (client.Click() and client.DblClick()), and topic links (client.Topic()). All other verbs are defined by the programmer.
+
Есть несколько заранее определённых операторов(verbs), принимающих ввод информации от игрока. Это кнопки направления\стрелки (напр. client.North()), щелчок мыши ((client.Click() и client.DblClick()) и ссылки топиков (client.Topic()). Все остальные операторы(verbs) задаются программистом.
 +
<!--The only pre-defined verbs are associated with the client data object. They are the direction keys (e.g. client.North()), mouse clicks (client.Click() and client.DblClick()), and topic links (client.Topic()). All other verbs are defined by the programmer.-->
   −
The general format for defining a verb includes any number of arguments. Each one may have a default value, an input type, and a list of possible values.
+
Общий вид для определения оператора(verb) следующий:
 +
: verb/Name(Arg1 = default input-type in List,...)
   −
verb/Name(Arg1 = Default as input-type in List,...)
+
Количество аргументов может быть любым. Каждый из них может иметь значение по умолчанию, тип ввода и список допустимых значений.
 +
<!--The general format for defining a verb includes any number of arguments. Each one may have a default value, an input type, and a list of possible values.-->
   −
===input instruction===
+
===Инструкция ввода===
   −
The input instruction allows you to ask the player for information. This is how DM provides server-initiated input. It is similar to a single verb argument.
+
Инструкция ввода - это то, что позволяет вам(со стороны игры) запросить у игрока информацию ввода. На ней построены все взаимоотношения сервера с клиентом. Она похожа на простой одиночный оператор(verb).
 +
<!--The input instruction allows you to ask the player for information. This is how DM provides server-initiated input. It is similar to a single verb argument.-->
   −
>input(User=usr,Message,Title,Default) input (User,Query,Title,Default) as input-type in List
+
: >input(User=usr,Message,Title,Default) input (User,Query,Title,Default) as input-type in List
User is the mob to input.
  −
Query is the input text.
  −
Title is the text to display in the titlebar.
  −
Default is the default value of the query.
  −
input-type is the type of input desired.
  −
List is a list of possible values.
  −
Returns value entered by player.
  −
All but the input text itself are optional parameters. User defaults to the current usr, which is usually the desired target. If no input type or possible value list is specified, the default input type is text. Otherwise, the input type defaults to accept anything in the supplied list, which contains the only values the user is allowed to enter.
     −
Note that the input instruction does not return until the user has entered a value. Since the entire multi-user system cannot halt while waiting for this to happen, only the current procedure waits. More will be said on the subject of multi-tasking in chapter 13.
+
User - это имя игрока(моба).
 +
Query - текст запроса ввода.
 +
Title - текст отображения запроса ввода.
 +
Default - значение по умолчанию для данного запроса.
 +
input-type - тип ввода информации.
 +
List - список возможных значений для данного запроса.
 +
Исполнение данного оператора задаёт значение введённое игроком. <!--Returns value entered by player.-->
 +
 
 +
Всё, кроме текста ввода - необязательные опциональные параметры. User ассоциируется с usr, и обращается к нему.
 +
Если input type не задано, то тип ввода информации будет текстовым по умолчанию.
 +
<!--All but the input text itself are optional parameters. User defaults to the current usr, which is usually the desired target. If no input type or possible value list is specified, the default input type is text. Otherwise, the input type defaults to accept anything in the supplied list, which contains the only values the user is allowed to enter.-->
 +
 
 +
Обратите внимание, что инструкция ввода не будет запрошена, пока пользователь не введёт значение. При поддержки многопользовательской системы ожидать ответа от одного пользователя невозможно, поэтому при запросе ввода информации в режим ожидания входит только текущая исполняемая процедура.
 +
<!--Note that the input instruction does not return until the user has entered a value. Since the entire multi-user system cannot halt while waiting for this to happen, only the current procedure waits. More will be said on the subject of multi-tasking in chapter 13.-->
    
One case in which the input instruction proves useful is when something happens in the game that the player needs to respond to. A verb would be too open-ended for the task, making it difficult for the player to guess what to do next.
 
One case in which the input instruction proves useful is when something happens in the game that the player needs to respond to. A verb would be too open-ended for the task, making it difficult for the player to guess what to do next.
470

правок

Навигация