Due to each server changing random parts of their answer you may need to modify the script to make it work.
from phBot import *
import phBotChat
import re
from time import sleep
def handle_chat(t, player, msg):
if len(player) == 0:
m = re.findall(r'(\d+)', msg)
if m and len(m) >= 2:
if msg.find('+') != -1 or msg.find(' x ') != -1:
result = int(m[0]) + int(m[1])
else:
result = int(m[0]) * int(m[1])
sleep(1.0)
log('Sending result %s' % str(result))
if msg.find('/answer') != -1:
phBotChat.All('/answer ' + str(result))
else:
phBotChat.All(str(result))
elif (player.find('JobSecure') != -1 or player.find('BotCheck') != -1) and msg.lower().find('job experience') != -1:
sleep(1.0)
phBotChat.Private(player, str(get_character_data()['job_current_exp']))
elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck':
m = re.findall(r'(\d+)', msg)
if m:
if len(m) == 1:
sleep(1.0)
log('Sending result %s' % str(m[0]))
phBotChat.Private(player, str(m[0]))
elif len(m) >= 2:
if msg.find('+') != -1 or msg.find(' x ') != -1:
result = int(m[0]) + int(m[1])
else:
result = int(m[0]) * int(m[1])
sleep(1.0)
log('Sending result %s' % str(result))
phBotChat.Private(player, str(result))
elif msg.lower().find('kervankey') != -1:
sleep(1.0)
phBotChat.Private(player, 'Kervankey')
log('[%s] Loaded' % __name__)
The character is Server (not [Server], just Server which sends the message. But there is a problem. The answer-check system is quite different.
At first you have to write a pm to Server character to this message: key , then this Server character randomly sends 7 number code to you and wants you to reply this code to it(Server character).
I hope you get what is system like. What do you prefer to solve this check method or is there any plugin which can work for that one?
This may work. In your script add the command request_key where you want to send System the key message.
from phBot import *
import phBotChat
import re
from time import sleep
def request_key(args):
phBotChat.Private('System', 'key')
return 5
def handle_chat(t, player, msg):
if len(player) == 0:
m = re.findall(r'(\d+)', msg)
if m and len(m) >= 2:
if msg.find('+') != -1 or msg.find(' x ') != -1:
result = int(m[0]) + int(m[1])
else:
result = int(m[0]) * int(m[1])
sleep(1.0)
log('Sending result %s' % str(result))
if msg.find('/answer') != -1:
phBotChat.All('/answer ' + str(result))
else:
phBotChat.All(str(result))
elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck' or player == 'System':
m = re.findall(r'(\d+)', msg)
if m:
if len(m) == 1:
sleep(1.0)
log('Sending result %s' % str(m[0]))
phBotChat.Private(player, str(m[0]))
elif len(m) >= 2:
if msg.find('+') != -1 or msg.find(' x ') != -1:
result = int(m[0]) + int(m[1])
else:
result = int(m[0]) * int(m[1])
sleep(1.0)
log('Sending result %s' % str(result))
phBotChat.Private(player, str(result))
elif msg.lower().find('kervankey') != -1:
sleep(1.0)
phBotChat.Private(player, 'Kervankey')
elif player.find('JobSecure') != -1:
sleep(1.0)
phBotChat.Private(player, str(get_character_data['job_current_exp']))
log('[%s] Loaded' % __name__)
Why you don´t try it yourself? The Code from Ryan is just a Sample and has to be modified for each server…
Im not sure this will work and its not tested:
from phBot import *
import phBotChat
import re
from time import sleep
def handle_chat(t, player, msg):
if len(player) == 0:
m = re.findall(r'(\d+)', msg)
if m and len(m) >= 2:
if msg.find('+') != -1 or msg.find(' x ') != -1:
result = int(m[0]) + int(m[1])
else:
result = int(m[0]) * int(m[1])
sleep(1.0)
log('Sending result %s' % str(result))
if msg.find('/answer') != -1:
phBotChat.All('/answer ' + str(result))
else:
phBotChat.All(str(result))
elif (player.find('System') != -1) and msg.lower().find('soru:') != -1:
s = msg.split(' ')
answer = int(s[1])*int(s[3])
sleep(1.0)
phBotChat.Private(player, str(answer))
log('[%s] Loaded' % __name__)
This only works if the numbers are always in the same place!