» TeamX (����� ������)«


����� TeamX » ������������ » ������� ������ (�������� "������������")

������� �� �����
<< ����. ����. >>
�������� ���� ���� [ 1 2 3 ] ��� ��������

 
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

��������� ������� ��� atoi. � ���������� � ������ :-(

Atoi - ��� ��������� ������������� string-����� � int-�����.

��������:

��� ���, ��� �� ������� ��������� ����������� �������� ���� (������, klngon Academy, ������������� ����) - ������� �� parse.c:
----------------------------------
/*
* Parser for SSL (Startrek Scripting Language).
*
* All variables are "typeless"; their type is defined by how
* they are used. �All types are promoted to the "highest" type
* in an expression, where the order is from lowest to highest:
* int, float, string.
*
* So,
* if you do 2 + "foo", you get back "2foo".
* if you do 2 + 2.4, � you get 4.4
* if you do 2 + 4, � � you get 6 (hopefully :)
* if you do 2 + 2.4 + "foo", you get "4.4foo", since
* expressions are parsed left to right.
* if you do 2 + (2.4 + "foo") you get "22.4foo", due
* to the parentheses.
* etc.
*/
----------------------------------

�.�.:
----------------------------------
variable a:="1234";
a+=1;
display_msg("a="+a);
----------------------------------
������� "a=12341".

��� ������ ����� �� �������� � msg-������ �������� ��������. � ������ ��� ���� �� ������, �.�. ����� ����� ������� � msg PID-� ���������, ������/�������� ��������� GVAR, ������ "��������" ������ - �.�. ������������ � �������� ������� �������� - ��� ��������� �� ����������, ������� ������ �� ������������� ����������� � ����������������� ��, ��� ���������� �����/PID.

����� ����, ����� ���� �� ������� ��� ���������� �����, �����, PID-� �������� ���������� � �������� ��������� ������; ��������� ������� ��� �������� ���, ����������� �� ����� "�� ����������"; �������� ������/����������, ����������� ��� ������/������� ������ - �.�. ��������� �������� ������������ ����.

������� ������:

����, � ��� ���� ������. ��� �� ����� � ���� ������? ������ �������? ������������ �����. �� ����� �� ����������:
"abc"=="abc" //true
"abc">"abc" //false
"b">"a" � � //true
"b">"abczz" //true
"abc">"abd" //false
"b">"A" � � //false

������� �������? ������ ������������ �����������, ��� ������ ������� �������� - ������������ ASCII-���� ��������. ������ � ������� ������� ������ ������ ��� ������.

��� ��� ��� ���? ���������� ������ "123". ��� �� ����� �������?
"123">"1". � "123"<"2"
�������? �� ������ ��� ������� ������ ������. ��������� ���. ������� ������.
"123">"11", "123">"12", "123"<"13".
����� ������. ��������� � �������.
"123">"121","123">"122","123"=="123". ����� ������. ����������� � ���������������� ������ �� ����� �������� ����� - ����������.

����� ���:
----------------------------------
procedure atoi(var str) begin
�var tmp_str:=""; //������������� �����������, ����� tmp_str="0"
�var value; //�������� ��������
�//""+0=="0"
�if (str>tmp_str+0 and str<tmp_str+1) or str==tmp_str+0 then begin
� �tmp_str+=0; //��������� ������. "123"+0=="1230"
� �value:=value*10+0; //"����������" ���� ������
�end
�//���� ��� ��������� ����
�<...>
----------------------------------

�� ��� ������ ���� ������� � ����:
----------------------------------
procedure atoi(var str) begin
�var tmp_str:=""; var value;
�var i; �//��� ����������� �� ����� ������������� ������

�while str!=tmp_str and i<16 do begin
� �if (str>tmp_str+0 and str<tmp_str+1) or str==tmp_str+0 then begin
� � �tmp_str+=0;
� � �value:=value*10+0;
� �end
� �<...>
� �i+=1;
�end
�if i!=16 then return value; //������ >16 �������� ���� �������� ���������� �������
�else return -1;
end
----------------------------------

������ ����-���� ��������, ����� ������� ����:
----------------------------------
procedure atoi(var str) begin
�var tmp_str:=""; var value; var i;
�var j; �//��� ����������� �� ����� ������������� ������

�while (str!=tmp_str) and j<16 do begin
� �//������������ ������� ���������. �������, ���������� :-)
� �while not ((str>tmp_str+i and str<tmp_str+(i+1)) or str==tmp_str+i) and i<9 do i+=1;
� �//��� i=9 ���������� ��������� �� �������� (str>...+9 and str<...+10)
� �//������ � �������� ������������ ��������
� �if i==9 and not (ostr>str+9 or ostr==str+9) then i:=10;
� �//���������� tmp_str � value
� �if i<10 then begin tmp_str+=i; value:=value*10+i; end
� �//� ������ ������� ���������� ������
� �else return -1;
� �i:=0;j+=1;
�end
�return val;
end
----------------------------------
����� �������� ������������ ��������� ������ 10 ����� :-)

�� ��� � ��. ������ ���� msg:
----------------------------------
{214}{}{2000}
----------------------------------
,�� ���
----------------------------------
give_exp(atoi(mstr(214));
----------------------------------
���� ���� 2000 �����.

�������� ��� ���������� ��������� (���� ���������� ���-���� ���������� �����-�����), ����� �������� � �������� ������� ini-�����, ��� ����� ���� ���������:
1. ����� �� ������ �����
2. ��������� ����� �� ������
3. �������� ��������� GVAR (����/������/���� � �.�.)
4. ������� �� ������

� �����, ������ const GVAR-�. �� � ����� �����, �������������� �� ���������. ������������ ����������.

P.S. Mynah, �� ������� ��� hear/see? �������, �� ���������.




=================================================



������ ����� NPC.

������� �� ������������ ��� ����� ������������ floater-����� ����� ����� ���? �����������.

�������:

����, � ��� ��� �������. � ��� �������� ������ (���� � ��� ��). ����������� ��� �� ����������.������ ����� ��������� ������� (������/������� - ���������� ���������). ��� ����� � ����� ������ ��������� floater-������? ��� ������������������ ������� floater-��, ���������� �� ������� (floater ��� ������ ���, ����� � �������, floater ��� ������ ��� ...). �.�. ��������, ��� ����������� �� � ������� add_timer_event. �������� ������ ������:

msg:
------------------------------
{1}{}{Phrase1}
{2}{}{Phrase2}
{3}{}{Phrase3}
{4}{}{Phrase4}
------------------------------

���:
------------------------------
export var begin
ptr_chat_1;
ptr_chat_2;
end

procedure start begin
end

procedure map_enter_p_proc begin
�if not ptr_chat_1 then ptr_chat_1:=self_obj;
�else ptr_chat_2:=self_obj;
end

procedure talk_p_proc begin
�var i:=1; //i==������ ����� ������ - ����. ���������

�while (mstr(i)!="Error") do begin
� �//��������� ������� �� ������� �/� 0,1,2,3 �������
� �add_timer_event(self_obj,i-1,i);
� �i+=1;
�end
end

procedure timed_event_p_proc begin
�var who; //��� �������
�//���� ����� ������� ������ - ������� ������ ���, ����� - ������
�if fixed_param%2 then who:=ptr_chat_1;
�else who:=ptr_chat_2;

�float_msg(who,mstr(fixed_param),0);
end
------------------------------

��. �����, �������, �������� ��� ��� ������ ������ ����� ���� - ��� ����������.

� ���� �������� ���������� ���� "���" - ������� ��� ������ � ��� - ������� �������� � ����. ������������. ��� ����� ���������? ������� ����, ������� � ���� � ������ �������, ���������� � �����. ��������� ������ - � ����� ������ ����� ���������� ������ timed_event, � �� ����� ���������� ������� (������� ���������� ����� � ����� ������). �.�. �� ������ �������� 4 ��������� ������� ��� ������ ���� + ��� ���� ��� ������ ����������. ��� �� ���������? ���� ����� ����� (������� �����) ����� ���� ����� - � �������������, � �������������, � ������� - �.�. ������� ��������� ������������� �������� ��������� �� "����������/�������� ����" ��, ������ ������, �� �����.

�����: "�������" ���������. ��� ������ � ��������� �����. �.�. �� "��������" ���� ������ ������������� �������� ��� "����", ������������ ��� ��������.

��������, ���� "0" �������, ��� �������� - ����� ������ � msg ��� floater. ���� ������ 3130 - ������ ����� ������� ������ 313, ������ 120 - ������� ������ 12, 900 - ������ 90. � ���� "1" ����� �������� �����/��������� ���� "������ ��� ���".

------------------------------
export var is_chatting;
<...>
//������ ������ �����
#define flag �(fixed_param%10)
//����� ��� ������� �������
#define param (fixed_param/10)

procedure timed_event_p_proc begin

�if flag==0 then begin

� �if param%2 then float_msg(ptr_chat_1,mstr(param),0)
� �else float_msg(ptr_chat_2,mstr(param),0);

�end else if flag==1 then is_chatting:=param;

end

procedure talk_p_proc begin
�var i:=1;
�//���� ��� ������� - ������ �� ������
�if is_chatting then return 0;

�//������������� ����
�add_timer_event(self_obj,0,11);

�//������� ������ ����� � ����������� ���� ������
�while (mstr(i)!="Error") do begin
� �add_timer_event(self_obj,i-1,i*10+0);
� �i+=1;
�end

�//��������� ������� ������ ����� �� ��������� ���������
�add_timer_event(self_obj,i,01);
end
------------------------------

��. ������, � timed_event/add_timer_event ����������� ������ ���������. ���������: ����, ���� ��������� �� ������, � ������� add_timer_event �� ����� "���������" ��� ��� ������ - �������������/������ LVAR-�, �������� ���������, ����������� ��������, �������� ������, ���������. ��� - ������ ������������� ��������������. �, ����, ����� ��������� � �-���������� :-)

���� ��� ���-��� - �������/������ ��������. �� �� ���� - � ��������� ������. �� ������������ ����� :-)

(��������������(�) Raven - 12:47 - 7 ���., 2004)

����������: 4:50 - 7 ���., 2004
Alan Killenger
������������

������: ������, ������
�����������: ���� 2004

�����: 404 ���������

���� ����� ������� �� ��������� � ������ ���� ��� ��������� �������, � ������ �� ����� ����������������?
������:

..
variable self_sing:=false;
..
procedure talk_p_proc begin
 if not(self_sing) then begin
   self_sing:=true;
   add_timer_event(self_obj,30,/*������� �����*/);
 end
end
..
procedure timed_event_p_proc begin
 if self_sing then
   self_sing:=sing_song(fixed_param,/*��������*/);
end
..
procedure sing_song(variable P_pos,variable P_delay) begin
 if /*��� ����� �����*/ then begin
   float_msg(self_obj,mstr(P_pos),0);
   add_timer_event(self_obj,P_delay,P_pos+1);
   return true;
 end else
   return false;
end
..


����� ������� ���������� self_sing ������������� ������ �������� false, ����� �����(��� *float ������) ����� ���������. ���� ����� ���� ������� ����������� � ����� �������� �������: ��������, ���� ��� ������ �� �������� �� 30 ������ ������� ���������� ������; ��� ���� ��� ���������� � NPC ������ ������ ������ �����.

-----
hit me, nail me, make me god

����������: 12:29 - 8 ���., 2004
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

��, ��� ����� ������� �����. � ��������� ����� ������� �������, as-is, ���� ����. ���������� � ������ ���������� ������ �� ����. �� ��� ����� �����������/����������, ����������, ��������������. � ������ ����� � is_chatting ������ ���� ��������� ���� ����������� ���� �� "��������" ���������� �������� � ����. ������ ����� ���������� ��� ��������� ��������� � �������������� ���� �������� �/� timed_event.

����������: 15:07 - 8 ���., 2004
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

Say-�����.

��� ��� ������ �����.

� ���� ���� ����� ������, ������������ � say, ������� �� ������� � API � �� ������������ � ����. ��������:
saystart
saysend
sayoption
sayreply
� �.�.

����� �� ������� ���������� ���������������� �����, ��� ������� � ���� �����������. ����, ��� ��� �����. ��� - ����� ����������� �������. ��-��, ������ ��, ��� ���������� � ������� start_gdialog, �� ���� ��� ����� �������. � ������:
1. �� ����� �������� ����������, ������� � ��������� reply- � option-���� (������������ �������� ������ ������� - � �������, � ������, � ���������� - ��������� �� �������)
2. �� ����� �������� �����, ���� ������, ��������� ��� ���������, ������������, �������
3. ��� ����������� ������� ���������� ����� (��� if-��������, ��������� ������ � �.�.) �� ��������� ��������� ��������� ����
4. ����� �������. ���� ����� ����� ���������������� � ����� ������ - �� ����� ���, �� ��������� etc. ����� ��� ������������� ��������� *�����������*. �.�. ����� �������, ��������, ���� �����, ������� ��� ������������� �� ��������� ������� say-�����, � �� ��� ��������� - �������� �� ���������. ��������, ��������� ���������.

����� ��� �������� � say-����� ��������������� (��� � ���������/��������). ����� - �������� ������ :-( ������� ��� ����� ������� ���������� ����� �� display-��������. �� �������� �� ���������-������ � �������� �������.

��� ����������.

���� ��� ���� �������� - ���������������� � �����������. � ����������������� ���������, ��������:

sayreplywindow(x,y,width,height,"path/to/pcx_file.pcx");
����� ����������, ������ � �������� ����. ���� - ������������ Data. �.�., ������ data/pcx, ����� ���� pcx-�������� � ����� ���� � �������.

setfont(num);
num - ����� ������ (1-5 � ����������, ��. ������ master.dat)

sayborder(x,y);
������� ��� ���������� � ���� ������ - �� ��������� � ����������� - � ����� ������.

�����, ���� ������, ����� ������� �� ���������.

������ ��� �����������. ������� ���� ������� � ����� �������� saystart. ����� ����� ������ �� saysend  
sayreply(str node_name, str text);
������ �������� - ��������� ����� (���� �������� ��������� � ������������ � �����������, ��������� sayreplywindow).
������ - ��� ��� ����� "����". ����� ��� ����� ����� �������� ������� � ����������� �� sayoption.

sayoption(str text,str/proc node);
������� ������� ������ � option-���� (��������� �������� � sayoptionwindow, ���������� reply).
��������! ���� ����� �� ����� ����, �� option ���� �� �������� � ����� �� ���������. ��� ����������� ������� ��� ���� ���� �������� �� reply-����. ������, ��������� ����� ������� �� ���� ������ �����������, �� �� ������������ �� ����� sayoption.
������ - �����. ������ - ��� ���� �� sayreply (� ��������) *���* ��� ���������� ��������� (��� �������).

������� ������:
-----------------------------
procedure start begin end

procedure critter_p_proc begin
end

procedure talk_p_proc begin
sayreplywindow(20,10,200,100,"111.pcx");
sayoptionwindow(230,10,200,100,"111.pcx");
setfont(5);
sayborder(10,10);

saystart;
sayreply("NodeHi","Hello");
sayoption("Hi. How it goes?","NodeHow");
sayoption("Bye","NodeClose");
sayreply("NodeHow","Fine, thanks");
sayoption("Well, gotta get moving.","NodeClose");
sayoption("Bye","NodeClose");
sayreply("NodeClose","Bye");
sayoption("Bye","Empty");
sayend;
end
-----------------------------

��� ������, ������� ��������������, ������ �������� � �.�. ��������� �����������, ���� �������� ������������ ������ �����, ��������� ��� � �.�. if-� ��������.

�����������, �����������, �������. ������ ���� pcx-��� ����������, ���������� � ������������� ����, ��������� ������ � ���������� ����������� � �.�.

��������� - ������ :-)

(��������������(�) Raven - 23:29 - 14 ���., 2005)

����������: 15:41 - 14 ���., 2005
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

��������, ���������� ����������� �� �����.

����������: 12:07 - 15 ���., 2005
Tehnokrat
���������

������: �����������
�����������: ���. 2003

�����: 489 ���������

��� ��� � ����� ����? � �����-������ ����. ����� ��-���� �������� ���������, � ������� ���� WG?

-----
������� ����� ������, �� ������ ��������. ������� ����� ��������, �� ������ ������.

����������: 23:48 - 15 ���., 2005
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

>>��� ��� � ����� ����?

���� �����.

>>� �����-������ ����. ����� ��-���� ��������

��� ������� - ����� �� ����.

����������: 0:36 - 16 ���., 2005
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

���������, ��� ����������� �� ����� ���� -  ���. ��, ��� �� ������� � vault13.gam, ����� ���� ������������ � ����.

��� ������� �� ����� ������?

����������: 16:16 - 20 ���., 2005
YikxX
������������

������: NCR :)
�����������: ����. 2004

�����: 304 ���������

��, � �������� ������ �����, ��� ����� ��������� ����� ��� ����� ���� ���� ����������. � �� ����� ������, ��� ��� ����� �����.

-----
��������! � �������� ���� �����...

����������: 17:00 - 20 ���., 2005
Raven
������������

������: ������
�����������: ����. 2004

�����: 408 ���������

�� ��� ��������� ����� :-)  � �, �����, ������ ����������� �� ����� ���� ������������� ��������� - � �� ���� ����� ����������� :-) ��� ��� ��� � ��������� ����, ���� :-)

����������: 17:27 - 20 ���., 2005
 

������� �� �����
<< ����. ����. >>
�������� ���� ���� [ 1 2 3 ] ��� ��������


Powered by Ikonboard 2.1.9 RUS
Modified by RU.Board Team
© 2000 Ikonboard.com