<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Автоответчик]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=11886&amp;type=atom" />
	<updated>2016-08-10T14:57:03Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=11886</id>
		<entry>
			<title type="html"><![CDATA[Re: Автоответчик]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=106707#p106707" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>RegExMatch(lastline, &quot;i).*\[([0-9]+)]:.*(Здравствуйте|Приветствую|даров|хэй)$&quot;, idPl)</code></pre></div><div class="quotebox"><cite>Palah пишет:</cite><blockquote><p>Да и как мне сделать чтобы бот отвечал на несколько вопросов?</p></blockquote></div><p>В смысле от нескольких пользователей разные вопросы? И через какое-то время а не сразу?<br />Тогда так:<br /></p><div class="codebox"><pre><code>FileCLog:=% A_MyDocuments &quot;\GTA San Andreas User Files\SAMP\chatlog.txt&quot;

loop
{
  lastline := GetNewLine(FileCLog)

  ; метасимволы: (\.*?+[{|()^$) перед каждым из них нужно ставить \

  if RegExMatch(lastline, &quot;i).*\[([0-9]+)]: (Как дела\?|Как дела7|чо как\?|сап)$&quot;, idPl)
  {
    id1:=idPl1
    settimer,answer1,-1000 ; answer1 сработает через секунду
  }
  else if RegExMatch(lastline, &quot;i).*\[([0-9]+)]:.*(Здравствуйте|Приветствую|даров|хэй)$&quot;, idPl)
  {
    id2:=idPl1
    settimer,answer2,-500 ; answer2 сработает через полсекунды
  }
}
return

answer1:
Sendinput {F6}/sms %id1% Как обычно.{Enter}
return

answer2:
Sendinput {F6}/sms %id2% Здравствуйте{Enter}
return

; и т.д.



GetNewLine(filename)
{
  static old
  static new
  if !old
  {
    FileGetSize, old, %filename%
    new := old
  }
  while old = new
  {
    sleep 100
    FileGetSize, new, %filename%
  }
  old := new
  Loop, read, %filename%
  if A_LoopReadLine
    last := A_LoopReadLine
  return last
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2016-08-10T14:57:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=106707#p106707</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Автоответчик]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=106700#p106700" />
			<content type="html"><![CDATA[<p>Не отвечает он к сожалению <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />Вот приведу пример из строчки:</p><p>[04:45:31] Ivan_urgant[604]: <strong>{FFCC99}</strong>Приветствую</p><p>И ответа от ahk почему то не последовало <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />Можете попробовать сделать чтобы он реагировал на слова после этого цвета?<br />Да и как мне сделать чтобы бот отвечал на несколько вопросов?<br />Мои ответы в одной строчке могут содержать и латинский и русскую раскладки.</p>]]></content>
			<author>
				<name><![CDATA[Palah]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34110</uri>
			</author>
			<updated>2016-08-10T10:11:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=106700#p106700</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Автоответчик]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=106682#p106682" />
			<content type="html"><![CDATA[<p>Попробуй так:<br /></p><div class="codebox"><pre><code>FileCLog:=% A_MyDocuments &quot;\GTA San Andreas User Files\SAMP\chatlog.txt&quot;

loop
{

  lastline := GetNewLine(FileCLog)

  ; метасимволы: (\.*?+[{|()^$) перед каждым из них нужно ставить \

  if RegExMatch(lastline, &quot;i).*\[([0-9]+)]: (Как дела\?|Как дела7|чо как\?|сап)$&quot;, idPl)
  {
    sleep,1000
    Sendinput {F6}/sms %idPl1% Как обычно.{Enter}
  }
  else if RegExMatch(lastline, &quot;i).*\[([0-9]+)]: (Здравствуйте|Приветствую|даров|хэй)$&quot;, idPl)
  {
    sleep,1000
    Sendinput {F6}/sms %idPl1% Здравствуйте{Enter}
  }
}

GetNewLine(filename)
{
  static old
  static new
  if !old
  {
    FileGetSize, old, %filename%
    new := old
  }
  while old = new
  {
    sleep 200
    FileGetSize, new, %filename%
  }
  old := new
  Loop, read, %filename%
  if A_LoopReadLine
    last := A_LoopReadLine
  return last
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2016-08-09T18:12:31Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=106682#p106682</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Автоответчик]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=106654#p106654" />
			<content type="html"><![CDATA[<p>Если вам будет так проще, то я хочу скинуть вам АХК, который нужно отредактировать на то, чтобы он срабатывал не на каждое сообщение которое заданно в чатлоге, а на сообщения только такого типа:<br /><strong>Ivan_Ivanov[228]</strong>: Как дела?<br />Ник и ID рандомные.</p><div class="codebox"><pre><code>FileCLog:=% A_MyDocuments &quot;\GTA San Andreas User Files\SAMP\chatlog.txt&quot;

loop
{

lastline := GetNewLine(FileCLog)

If lastline contains привет,здрав,здаров, ѕривет
{
RegExMatch(lastline, &quot;i).*\[([0-9]*)\]: \{FFCD00\}.*&quot;, idPl)
Sendinput {F6}/sms %idPl1% Здравствуйте{Enter}
}

}

GetNewLine(filename)
{ ;функци¤ чтени¤ последней строки, если файл изменен каждыее 2000 мс
static old
static new
if !old
{
FileGetSize, old, %filename%
new := old
}
while old = new
{
sleep 2000
FileGetSize, new, %filename%
}
old := new
Loop, read, %filename%
if A_LoopReadLine
{
last := A_LoopReadLine ;последн¤¤ строка
}
return last
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Palah]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34110</uri>
			</author>
			<updated>2016-08-07T15:16:10Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=106654#p106654</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Автоответчик]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=106629#p106629" />
			<content type="html"><![CDATA[<p>Добрый день. Мне нужен АХК скрипт, который может отвечать на заданные вопросы заданным ответом, но чтобы он отвечал не обычным способом, то есть я хочу чтобы бот отвечал на предложения: Как дела? ; Как здоровье?. Вот такое сообщение: Хорошо.<br />Но чтобы это было не на любой текст в чате, а на определенный. Пример: </p><p><strong>Ivan_Ivanon[228]</strong>: Как дела?<br />(Ник и ID <span class="bbu">рандомный</span>)</p><p>А бот ответил бы таким образом:<br />/sms 228 Хорошо.<br />(ID <span class="bbu">рандомный</span>).</p><p>Я не хочу чтобы он отвечал на сообщения такого типа:<br />Как здоровье (Ivan_Ivanov) [228]</p><p>Думаю вы поняли мою мысть :). Надеюсь поможете.</p>]]></content>
			<author>
				<name><![CDATA[Palah]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34110</uri>
			</author>
			<updated>2016-08-06T16:45:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=106629#p106629</id>
		</entry>
</feed>
