Jump to content

Recommended Posts

Posted

Its finally here and finished. If there are ANY bugs, please report them (I worked on this script for a while, hoping theres 0...)

 

The only thing needed to edit are settings, and word lists. Once you make your word list, you dont need to make em again, you can use them for every character. So its a one shot deal. Feel free to post your word dictionary.

 

I've worked two releases... one which can easily be added into another script, and another which can be ran just like that. Here they are.

 

Download link with everything

http://www.filefront.com/13969901/AutoReply.rar/

 

README


******************************************************
Welcome, and thank you for the interest in this script.
This script took a while to work out all of the kinks
and bugs, as well as adding new features... well over
30 hours of work in this script. Testing is very time
consuming :P... Theres been over 20 betas o_O

******************************************************
***************HOW TO*********************************
******************************************************

Well, theres two versions of this script included,

Version 1: Stand Alone script
Its pretty simple, open up the script, read through
and set according to your liking. You can put this
file anywhere. Remember to add more word base :)

Version 2: Include/add-on script
First off, put the "autoreplyCALLEXTERN.l2s" script
in L2.NET BETA\Scripts\Include

Next, add the following line to the beginning of your
script, may it be a simple shop script or an advanced
custom autofighter script. (just make sure the script
never ends)

THREAD AUTOREPLY

Next, scroll all the way down to the end of your script
and add the following.

FUNCTION AUTOREPLY
CALL_EXTERN "INCLUDE/autoreplyCALLEXTERN.l2s" REPLYSCRIPTSET VOID 23 #iA #iB #iC #iD #iE #iF #iG #iH #iI #iJ #iK #iL #iM #iN #iO #iP #iQ #iR #iS #iT #iU #iV #IW
PRINT_TEXT "SCRIPT ENDED"
RETURN VOID

Every letter after the number "23" represents a setting, here is the list. (replace the letters with your choice)

A = Debug? 0 = off // 1 = on
B = How many seconds before another message can be sent? Calculated in SECONDS.
C = Do you want to allow sound alerts for chat messages? 0 = off // 1 = on
D = Do you want to allow sound alerts when being attacked by the same person? 0 = off // 1 = on
E = Do you want to allow alerts for when a player attacks you? 0 = off // 1 = on
F = Do you want to replys to melee (when a player attacks you) 0 = off // 1 = on
G = Do you want to replys to any skills (when a player attacks you) 0 = off // 1 = on
H = Do you want to replys to ANY chat? WARNING, if this is turned off, no replys will be made to ANY chat channels! 0 = off // 1 = on

//Channel settings
I = All chat
J = Shout
K = Private message
L = Party chat
M = Clan chat
N = GM
O = Petition
P = Petition2
Q = Trade
R = Ally chat
S = Announcement
T = Boat chat
U = partyroom chat
V = PartyCommander chat
W = Hero

 

 

Stand Alone Version

PRINT_TEXT "Autoreply script made by mpj123, this is the STAND ALONE version."
PRINT_TEXT "Special thanks to d00d for the packet info from his Buff Awareness Script"
PRINT_TEXT "Special thanks to galozeh, and Jeapordy for ideas, beta testing and code."
PRINT_TEXT "And ofc slothmo for his hard work, making this possible :)"
PRINT_TEXT "More scripts at ltwonet.com! JOIN US NOW! Be a part of the L2.NET community!"

//Debug? 0 = off // 1 = on
DEFINE_GLOBAL INT DEBUG 0

//How many seconds before another message can be sent? Calculated in SECONDS.
//Recommended 10 to 60
DEFINE_GLOBAL INT DelayBetweenMessages 13

//Do you want to allow sound alerts for chat messages? 0 = off // 1 = on
DEFINE_GLOBAL INT ENABLESOUND 1

//Do you want to allow sound alerts when being attacked by the same person? 0 = off // 1 = on
DEFINE_GLOBAL INT ENABLESOUND2 1

//Do you want to replys to melee skills (when a player attacks you) 0 = off // 1 = on
DEFINE_GLOBAL INT MELEEREPLYTOGGLE 1

//Do you want to replys to any skills (when a player attacks you) 0 = off // 1 = on
DEFINE_GLOBAL INT SKILLREPLYTOGGLE 1

//Do you want to allow alerts for when a player attacks you
DEFINE_GLOBAL INT ENABLESOUND3 1

//Do you want to replys to ANY chat?
//WARNING, if this is turned off, no replys will be made to ANY chat channels! 0 = off // 1 = on
DEFINE_GLOBAL INT CHATREPLYTOGGLE 1

//Which channel should be monitored... /// 1 = enable // 0 = disable
//All chat
DEFINE_GLOBAL INT CHAN0 1
//Shout
DEFINE_GLOBAL INT CHAN1 1
//Private message
DEFINE_GLOBAL INT CHAN2 1
//Party chat
DEFINE_GLOBAL INT CHAN3 0
//Clan chat
DEFINE_GLOBAL INT CHAN4 0
//GM
DEFINE_GLOBAL INT CHAN5 1
//Petition
DEFINE_GLOBAL INT CHAN6 1
//Petition2
DEFINE_GLOBAL INT CHAN7 1
//Trade
DEFINE_GLOBAL INT CHAN8 0
//Ally chat
DEFINE_GLOBAL INT CHAN9 0
//Announcement
DEFINE_GLOBAL INT CHAN10 0
//Boat chat
DEFINE_GLOBAL INT CHAN11 0
//partyroom chat
DEFINE_GLOBAL INT CHAN15 0
//PartyCommander chat
DEFINE_GLOBAL INT CHAN16 0
//Hero
DEFINE_GLOBAL INT CHAN17 0


//your nicknames.... for instance if you name is killerbeast, your nicknames could be Kill, Beast
//WARNING, names MUST BE IN lower case! KILLERBEAST would NEED to be killerbeast to work.
DEFINE_GLOBAL ARRAYLIST MyName 0
MyName.ADD "#$kill"
MyName.ADD "#$beast"
MyName.ADD "#$killbeast"
//add more if you wish

//If somebody attacks you with a skill or melee
DEFINE_GLOBAL ARRAYLIST AttackReply 0
AttackReply.ADD "#$Yo buddy"
AttackReply.ADD "#$Not nice :("
AttackReply.ADD "#$WAAAA"
//add more if you wish

//This arraylist is to define all the words you wish to reply to.
DEFINE_GLOBAL ARRAYLIST STRINGREPLY 0
STRINGREPLY.ADD "#$bot" //1
STRINGREPLY.ADD "#$noob" //2
STRINGREPLY.ADD "#$naab" //3
STRINGREPLY.ADD "#$<&CHAR_NAME&>" //4
//add more if you wish

//
//Start of replys
//

DEFINE_GLOBAL ARRAYLIST Reply1 0
Reply1.ADD "#$Nope"
Reply1.ADD "#$haha"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply2 0
Reply2.ADD "#$Low."
Reply2.ADD "#$I cant say :)"
Reply2.ADD "#$No comprende BR mangs! JAJAJA"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply3 0
Reply3.ADD "#$Low."
Reply3.ADD "#$I cant say :)"
Reply3.ADD "#$No comprende BR mangs! JAJAJA"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply4 0
Reply4.ADD "#$Am I ^^"
//add more if you wish

//
//End of replys
//

DEFINE_GLOBAL ARRAYLIST PHRASEREPLY 0

//you will need to add more Reply(number) if you added more responses.
PHRASEREPLY.ADD Reply1
PHRASEREPLY.ADD Reply2
PHRASEREPLY.ADD Reply3
PHRASEREPLY.ADD Reply4
//add more if you wish


//
//
//
//
//END OF USER-SET OPTIONS
//
//DO NOT TOUCH
//
//
//
//

//Arraylists
DEFINE_GLOBAL ARRAYLIST SAVELIST 0

//INT
DEFINE_GLOBAL INT IsItPrivate 0
DEFINE_GLOBAL INT PhraseToSay 0
DEFINE_GLOBAL INT PhraseToSay2 0
DEFINE_GLOBAL INT HowManyLines 0
DEFINE_GLOBAL INT MESSAGEVAR 0
DEFINE_GLOBAL INT MESSAGESENT 1
DEFINE_GLOBAL INT CURRENTNUMBER 0
DEFINE_GLOBAL INT TYPEMESSAGE 0
DEFINE_GLOBAL INT LASTID 0
DEFINE_GLOBAL INT GLOBALTIMER 10
DEFINE_GLOBAL INT TimeCalc 0
DEFINE_GLOBAL INT TimeCalc1 0
DEFINE_GLOBAL INT DONOTTALK 0

//STRINGS
DEFINE_GLOBAL STRING PNAME ""
DEFINE_GLOBAL STRING MESSAGELOWER ""
DEFINE_GLOBAL STRING STRCURRENT ""
DEFINE_GLOBAL STRING MESSAGEREPLY ""
DEFINE_GLOBAL STRING MESSAGEREPLY2 ""
DEFINE_GLOBAL STRING HowManyLines2 ""
DEFINE_GLOBAL STRING SelfReply "-><&Char_name&>"

IF MELEEREPLYTOGGLE == ONE
//Melee Attack
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" Melee 51
ENDIF
IF SKILLREPLYTOGGLE == ONE
//Skill User
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" SkillUser 72
ENDIF

IF CHATREPLYTOGGLE == ONE
//Chat
SET_EVENT "<&SCRIPTEVENT_CHAT&>" "<&SYSTEM_CURRENTFILE&>" Reply
//Canceled skill
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" NOTHING 73
ENDIF

//Time Counter and Infinit Loop
IF DEBUG == ONE
PRINT_TEXT "TimeCounter thread started"
ENDIF
GLOBALTIMER = DelayBetweenMessages
WHILE ZERO == ZERO
SLEEP 1000
GLOBALTIMER = GLOBALTIMER + ONE
IF DEBUG == ONE
PRINT_TEXT "<&GLOBALTIMER&>"
ENDIF
WEND
************************************************************************************************************
***************************************Functions**************************************************************
************************************************************************************************************
//
//FUNCTION REPLY
//

Function REPLY
IF DEBUG == ONE
PRINT_TEXT "in REPLY function"
ENDIF
MESSAGESENT = ONE
MESSAGELOWER = MESSAGE.TO_LOWER_INVARIANT
TYPEMESSAGE = MESSAGETYPE

IF DEBUG == ONE
PRINT_TEXT "This is the message: <&MESSAGE&>"
PRINT_TEXT "This is the message in lower caps: <&MESSAGELOWER&>"
ENDIF

IF DEBUG == ONE
PRINT_TEXT "This is a name to ignore: <&SelfReply&>"
ENDIF

IF SENDERNAME == SelfReply
IF DEBUG == ONE
PRINT_TEXT "Self testing.... ignoring second PM"
ENDIF
RETURN VOID
ENDIF

IF ENABLESOUND == ONE
FOREACH I STRING MyName
PNAME = MyName.I
//Print_text "<&PNAME&>"
IF "MESSAGELOWER.CONTAINS PNAME" == TRUE
PRINT_TEXT "PLAYING WAVE SOUND, <&SENDERNAME&> is calling us!"
PLAYALARM
ENDIF
NEXTEACH
ENDIF

TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF

CALLSUB REPLYNOW
RETURN VOID

//
//Melee
//

FUNCTION Melee
IF DEBUG == ONE
PRINT_TEXT "in Melee function"
ENDIF
DEFINE STRING TargeteeName ""
DEFINE INT p_MSU_packet_type2 0
DEFINE INT p_MSU_source_id2 0
DEFINE INT p_MSU_target_id2 0

PACKET.READ_BYTE p_MSU_packet_type2
PACKET.READ_INT32 p_MSU_source_id2
PACKET.READ_INT32 p_MSU_target_id2

CHAR_GET_NAME TargeteeName "<&p_MSU_source_id2&>"

IF DEBUG == ONE
PRINT_TEXT "This is the name of the attacker: <&TargeteeName&>"
ENDIF

IF TargeteeName == "#$<&CHAR_NAME&>"
IF DEBUG == ONE
PRINT_TEXT "seems like this packet is from ourselves attacking, not replying to this"
ENDIF
RETURN VOID
ENDIF

IF TargeteeName == "#$-nobody-"
IF DEBUG == ONE
PRINT_TEXT "This is a mob attacking, no need to reply"
ENDIF
RETURN VOID
ENDIF

IF DEBUG == ONE
PRINT_TEXT "attack coming from:<&p_MSU_source_id2&> Hitting: <&p_MSU_target_id2&>"
ENDIF

IF ENABLESOUND3 == ONE
IF DEBUG == ONE
PRINT_TEXT "Melee function alarm activated!"
ENDIF
PLAYALARM
ENDIF

IF LASTID == p_MSU_source_id2
IF DEBUG == ONE
PRINT_TEXT "Hey, thats the same person trying to get us to talk again! What a douche."
ENDIF
IF ENABLESOUND2 == ONE
IF DEBUG == ONE
PRINT_TEXT "ENABLESOUND2 is ringing!"
ENDIF
PLAYALARM
ENDIF
ENDIF

IF p_MSU_target_id2 == CHAR_ID
LASTID = p_MSU_source_id2
TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF
IF DEBUG == ONE
PRINT_TEXT "We are getting hit with melee or ranged."
PRINT_TEXT "Our char ID = <&CHAR_ID&>"
ENDIF
CALLSUB TALKBACK
ENDIF

RETURN VOID

//
//FUNCTION SkillUser
//

FUNCTION SkillUser
IF DEBUG == ONE
PRINT_TEXT "in SkillUser function"
ENDIF

DEFINE INT p_MSU_packet_type 0
DEFINE INT p_MSU_source_id 0
DEFINE INT p_MSU_target_id 0
DEFINE INT p_MSU_skill_id 0
DEFINE INT p_MSU_skill_level 0
DEFINE INT p_MSU_hit_time 0
DEFINE INT p_MSU_reuse_delay 0

PACKET.READ_BYTE p_MSU_packet_type
PACKET.READ_INT32 p_MSU_source_id
PACKET.READ_INT32 p_MSU_target_id
PACKET.READ_INT32 p_MSU_skill_id
PACKET.READ_INT32 p_MSU_skill_level
PACKET.READ_INT32 p_MSU_hit_time
PACKET.READ_INT32 p_MSU_reuse_delay

DEFINE STRING TargeteeName ""
CHAR_GET_NAME TargeteeName "<&p_MSU_source_id&>"

IF DEBUG == ONE
PRINT_TEXT "This is the name of the attacker: <&TargeteeName&>"
ENDIF

IF TargeteeName == "#$<&CHAR_NAME&>"
IF DEBUG == ONE
PRINT_TEXT "seems like this packet is from ourselves attacking, not replying to this"
ENDIF
RETURN VOID
ENDIF

IF TargeteeName == "#$-nobody-"
IF DEBUG == ONE
PRINT_TEXT "This is a mob attacking, no need to reply"
ENDIF
RETURN VOID
ENDIF

IF ENABLESOUND3 == ONE
IF DEBUG == ONE
PRINT_TEXT "Skill function alarm activated!"
ENDIF
PLAYALARM
ENDIF

IF DEBUG == ONE
PRINT_TEXT "Who the caster is targetting: ID = <&p_MSU_target_id&>"
ENDIF

IF LASTID == p_MSU_source_id
IF DEBUG == ONE
PRINT_TEXT "Hey, thats the same person trying to get us to talk again! What a douche."
ENDIF
IF ENABLESOUND2 == ONE
PLAYALARM
ENDIF
ENDIF

IF p_MSU_target_id == CHAR_ID
LASTID = p_MSU_source_id
TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF

IF DEBUG == ONE
PRINT_TEXT "We are getting casted on with magic by <&p_MSU_source_id&> in <&p_MSU_hit_time&> Milliseconds"
PRINT_TEXT "Our char ID = <&CHAR_ID&>"
ENDIF
CALLSUB SKILLWATCHFORCANCEL
ENDIF
RETURN VOID

//
//Fucntion SkillCanceled
//

FUNCTION SkillCanceled
IF DEBUG == ONE
PRINT_TEXT "in SkillCanceled function"
ENDIF
DEFINE INT p_MSU_packet_type2 0
DEFINE INT p_MSU_source_id2 0

PACKET.READ_BYTE p_MSU_packet_type2
PACKET.READ_INT32 p_MSU_source_id2

IF DEBUG == ONE
PRINT_TEXT "<&p_MSU_source_id2&>"
ENDIF

IF LASTID == p_MSU_source_id2
IF DEBUG == ONE
PRINT_TEXT "User stopped his cast! We wont say anything!"
ENDIF
DONOTTALK = ONE
ENDIF
RETURN VOID

FUNCTION NOTHING
IF DEBUG == ONE
PRINT_TEXT "Function NOTHING fired up"
ENDIF
//does nothing
RETURN VOID

************************************************************************************************************
***************************************SUBS**************************************************************
************************************************************************************************************

SUB REPLYNOW

//
//Pre message-code, do not touch unless you know what your doing.
//
IF DEBUG == ONE
PRINT_TEXT "in REPLYNOW sub"
ENDIF


IF TYPEMESSAGE == CHANNEL_PRIVATE
IsItPrivate = ONE
IF DEBUG == ONE
PRINT_TEXT "ITS A PRIVATE MESSAGE"
ENDIF
ELSE
IsItPrivate = ZERO
IF DEBUG == ONE
PRINT_TEXT "ITS NOT A PRIVATE MESSAGE"
ENDIF
ENDIF


SWITCH TYPEMESSAGE
CASE #i0
IF CHAN0 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i0
BREAK 1
CASE #i1
IF CHAN1 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i1
BREAK 1
CASE #i2
IF CHAN2 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i2
BREAK 1
CASE #i3
IF CHAN3 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i3
BREAK 1
CASE #i4
IF CHAN4 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i4
BREAK 1
CASE #i5
IF CHAN5 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i5
BREAK 1
CASE #i6
IF CHAN6 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i6
BREAK 1
CASE #i7
IF CHAN7 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i7
BREAK 1
CASE #i8
IF CHAN8 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i8
BREAK 1
CASE #i9
IF CHAN9 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i9
BREAK 1
CASE #i10
IF CHAN10 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i10
BREAK 1
CASE #i11
IF CHAN11 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i11
BREAK 1
CASE #i15
IF CHAN15 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i15
BREAK 1
CASE #i16
IF CHAN16 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i16
BREAK 1
CASE #i17
IF CHAN17 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i17
BREAK 1
DEFAULT
RETURNSUB
BREAK 1
ENDSWITCH

//
//END of pre-message code
//

IF DEBUG == ONE
PRINT_TEXT "<&MESSAGEVAR&>"
ENDIF

FOREACH W string STRINGREPLY
STRCURRENT = "#$<&STRINGREPLY.W&>"
SAVELIST = PHRASEReply.W
MESSAGEREPLY = "#$SAVELIST.PhraseToSay"
HowManyLines = SAVELIST.COUNT
GET_RAND PhraseToSay 0 "<&HowManyLines&>"

IF DEBUG == ONE
PRINT_TEXT "HowManyLines = <&HowManyLines&>"
PRINT_TEXT "MESSAGEREPLY = <&MESSAGEREPLY&>"
PRINT_TEXT "STRCURRENT = <&STRCURRENT&>"
ENDIF

IF "MESSAGELOWER.CONTAINS #$<&STRCURRENT&>" == TRUE
SLEEP 500
IF IsItPrivate == ONE
SLEEP_HUMAN_READING "<&MESSAGE&>"
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY&>"
TimeCalc = GLOBALTIMER
SAY_TEXT "<&MESSAGEVAR&>" "<&<&MESSAGEREPLY&>&>" "<&SENDERNAME&>"
RETURNSUB
ELSE
SLEEP_HUMAN_READING "<&MESSAGE&>"
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY&>"
TimeCalc = GLOBALTIMER
SAY_TEXT "<&MESSAGEVAR&>" "<&<&MESSAGEREPLY&>&>"
RETURNSUB
ENDIF
ENDIF
NEXTEACH
RETURNSUB


//
//SUB SKILLWATCHFORCANCEL
//

SUB SKILLWATCHFORCANCEL
LOCK SkillUser
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" SkillCanceled 73
SLEEP "<&p_MSU_hit_time&>"
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" NOTHING 73
UNLOCK SkillUser
CALLSUB TALKBACK
RETURNSUB

//
//SUB TALKBACK
//

SUB TALKBACK
IF DONOTTALK == ZERO
TimeCalc = GLOBALTIMER
HowManyLines2 = "AttackReply.COUNT"
GET_RAND PhraseToSay2 0 "<&HowManyLines2&>"
MESSAGEREPLY2 = "#$AttackReply.PhraseToSay2"
SLEEP 2000
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY2&>"
SAY_TEXT "CHANNEL_ALL" "<&<&MESSAGEREPLY2&>&>"
IF DEBUG == ONE
PRINT_TEXT "SENT MESSAGE!"
ENDIF
ELSE
IF DEBUG == ONE
PRINT_TEXT "-beep-er canceled his skill, trying to see if were bots, not replying."
ENDIF
ENDIF
DONOTTALK = ZERO
RETURNSUB

 

 

Posted

Include Version

FUNCTION REPLYSCRIPTSET 23 A B C D E F G H I J K L M N O P Q R S T U V W

PRINT_TEXT "Autoreply made by mpj123, this is the CALL_EXTERN version"
PRINT_TEXT "Special thanks to d00d for the packet info from his Buff Awareness Script"
PRINT_TEXT "Special thanks to galozeh, and Jeapordy for ideas, beta testing and code."
PRINT_TEXT "And ofc slothmo for his hard work, making this possible :)"
PRINT_TEXT "More scripts at ltwonet.com! JOIN US NOW! Be a part of the L2.NET community!"

//Debug? 0 = off // 1 = on
DEFINE_GLOBAL INT DEBUG <&A&>

//How many seconds before another message can be sent? Calculated in SECONDS.
//Recommended 10 to 60
DEFINE_GLOBAL INT DelayBetweenMessages <&B&>

//Do you want to allow sound alerts for chat messages? 0 = off // 1 = on
DEFINE_GLOBAL INT ENABLESOUND <&C&>

//Do you want to allow sound alerts when being attacked by the same person? 0 = off // 1 = on
DEFINE_GLOBAL INT ENABLESOUND2 <&D&>

//Do you want to allow alerts for when a player attacks you
DEFINE_GLOBAL INT ENABLESOUND3 <&E&>

//Do you want to replys to melee (when a player attacks you) 0 = off // 1 = on
DEFINE_GLOBAL INT MELEEREPLYTOGGLE <&F&>

//Do you want to replys to any skills (when a player attacks you) 0 = off // 1 = on
DEFINE_GLOBAL INT SKILLREPLYTOGGLE <&G&>

//Do you want to replys to ANY chat?
//WARNING, if this is turned off, no replys will be made to ANY chat channels! 0 = off // 1 = on
DEFINE_GLOBAL INT CHATREPLYTOGGLE <&H&>

//Which channel should be monitored... /// 1 = enable // 0 = disable
//All chat
DEFINE_GLOBAL INT CHAN0 <&I&>
//Shout
DEFINE_GLOBAL INT CHAN1 <&J&>
//Private message
DEFINE_GLOBAL INT CHAN2 <&K&>
//Party chat
DEFINE_GLOBAL INT CHAN3 <&L&>
//Clan chat
DEFINE_GLOBAL INT CHAN4 <&M&>
//GM
DEFINE_GLOBAL INT CHAN5 <&N&>
//Petition
DEFINE_GLOBAL INT CHAN6 <&O&>
//Petition2
DEFINE_GLOBAL INT CHAN7 <&P&>
//Trade
DEFINE_GLOBAL INT CHAN8 <&Q&>
//Ally chat
DEFINE_GLOBAL INT CHAN9 <&R&>
//Announcement
DEFINE_GLOBAL INT CHAN10 <&S&>
//Boat chat
DEFINE_GLOBAL INT CHAN11 <&T&>
//partyroom chat
DEFINE_GLOBAL INT CHAN15 <&U&>
//PartyCommander chat
DEFINE_GLOBAL INT CHAN16 <&V&>
//Hero
DEFINE_GLOBAL INT CHAN17 <&W&>


//your nicknames.... for instance if you name is killerbeast, your nicknames could be Kill, Beast
//WARNING, names MUST BE IN lower case! KILLERBEAST would NEED to be killerbeast to work.
DEFINE_GLOBAL ARRAYLIST MyName 0
MyName.ADD "#$kill"
MyName.ADD "#$beast"
MyName.ADD "#$killbeast"
//add more if you wish

//If somebody attacks you with a skill or melee
DEFINE_GLOBAL ARRAYLIST AttackReply 0
AttackReply.ADD "#$Yo buddy"
AttackReply.ADD "#$Not nice :("
AttackReply.ADD "#$WAAAA"
//add more if you wish

//This arraylist is to define all the words you wish to reply to.
DEFINE_GLOBAL ARRAYLIST STRINGREPLY 0
STRINGREPLY.ADD "#$bot" //1
STRINGREPLY.ADD "#$noob" //2
STRINGREPLY.ADD "#$naab" //3
STRINGREPLY.ADD "#$<&CHAR_NAME&>" //4
//add more if you wish

//
//Start of replys
//

DEFINE_GLOBAL ARRAYLIST Reply1 0
Reply1.ADD "#$Nope"
Reply1.ADD "#$haha"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply2 0
Reply2.ADD "#$Low."
Reply2.ADD "#$I cant say :)"
Reply2.ADD "#$No comprende BR mangs! JAJAJA"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply3 0
Reply3.ADD "#$Low."
Reply3.ADD "#$I cant say :)"
Reply3.ADD "#$No comprende BR mangs! JAJAJA"
//add more if you wish

DEFINE_GLOBAL ARRAYLIST Reply4 0
Reply4.ADD "#$Am I ^^"
//add more if you wish

//
//End of replys
//

DEFINE_GLOBAL ARRAYLIST PHRASEREPLY 0

//you will need to add more Reply(number) if you added more responses.
PHRASEREPLY.ADD Reply1
PHRASEREPLY.ADD Reply2
PHRASEREPLY.ADD Reply3
PHRASEREPLY.ADD Reply4
//add more if you wish


//
//
//
//
//END OF USER-SET OPTIONS
//
//DO NOT TOUCH
//
//
//
//

//Arraylists
DEFINE_GLOBAL ARRAYLIST SAVELIST 0

//INT
DEFINE_GLOBAL INT IsItPrivate 0
DEFINE_GLOBAL INT PhraseToSay 0
DEFINE_GLOBAL INT PhraseToSay2 0
DEFINE_GLOBAL INT HowManyLines 0
DEFINE_GLOBAL INT MESSAGEVAR 0
DEFINE_GLOBAL INT MESSAGESENT 1
DEFINE_GLOBAL INT CURRENTNUMBER 0
DEFINE_GLOBAL INT TYPEMESSAGE 0
DEFINE_GLOBAL INT LASTID 0
DEFINE_GLOBAL INT GLOBALTIMER 10
DEFINE_GLOBAL INT TimeCalc 0
DEFINE_GLOBAL INT TimeCalc1 0
DEFINE_GLOBAL INT DONOTTALK 0

//STRINGS
DEFINE_GLOBAL STRING PNAME ""
DEFINE_GLOBAL STRING MESSAGELOWER ""
DEFINE_GLOBAL STRING STRCURRENT ""
DEFINE_GLOBAL STRING MESSAGEREPLY ""
DEFINE_GLOBAL STRING MESSAGEREPLY2 ""
DEFINE_GLOBAL STRING HowManyLines2 ""
DEFINE_GLOBAL STRING SelfReply "-><&Char_name&>"

IF MELEEREPLYTOGGLE == ONE
//Melee Attack
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" Melee 51
ENDIF
IF SKILLREPLYTOGGLE == ONE
//Skill User
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" SkillUser 72
ENDIF

IF CHATREPLYTOGGLE == ONE
//Chat
SET_EVENT "<&SCRIPTEVENT_CHAT&>" "<&SYSTEM_CURRENTFILE&>" Reply
//Canceled skill
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" NOTHING 73
ENDIF

//Time Counter and Infinit Loop
IF DEBUG == ONE
PRINT_TEXT "TimeCounter thread started"
ENDIF
GLOBALTIMER = DelayBetweenMessages
WHILE ZERO == ZERO
SLEEP 1000
GLOBALTIMER = GLOBALTIMER + ONE
IF DEBUG == ONE
PRINT_TEXT "<&GLOBALTIMER&>"
ENDIF
WEND
************************************************************************************************************
***************************************Functions**************************************************************
************************************************************************************************************
//
//FUNCTION REPLY
//

Function REPLY
IF DEBUG == ONE
PRINT_TEXT "in REPLY function"
ENDIF
MESSAGESENT = ONE
MESSAGELOWER = MESSAGE.TO_LOWER_INVARIANT
TYPEMESSAGE = MESSAGETYPE

IF DEBUG == ONE
PRINT_TEXT "This is the message: <&MESSAGE&>"
PRINT_TEXT "This is the message in lower caps: <&MESSAGELOWER&>"
ENDIF

IF DEBUG == ONE
PRINT_TEXT "This is a name to ignore: <&SelfReply&>"
ENDIF

IF SENDERNAME == SelfReply
IF DEBUG == ONE
PRINT_TEXT "Self testing.... ignoring second PM"
ENDIF
RETURN VOID
ENDIF

IF ENABLESOUND == ONE
FOREACH I STRING MyName
PNAME = MyName.I
//Print_text "<&PNAME&>"
IF "MESSAGELOWER.CONTAINS PNAME" == TRUE
PRINT_TEXT "PLAYING WAVE SOUND, <&SENDERNAME&> is calling us!"
PLAYALARM
ENDIF
NEXTEACH
ENDIF

TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF

CALLSUB REPLYNOW
RETURN VOID

//
//Melee
//

FUNCTION Melee
IF DEBUG == ONE
PRINT_TEXT "in Melee function"
ENDIF
DEFINE STRING TargeteeName ""
DEFINE INT p_MSU_packet_type2 0
DEFINE INT p_MSU_source_id2 0
DEFINE INT p_MSU_target_id2 0

PACKET.READ_BYTE p_MSU_packet_type2
PACKET.READ_INT32 p_MSU_source_id2
PACKET.READ_INT32 p_MSU_target_id2

CHAR_GET_NAME TargeteeName "<&p_MSU_source_id2&>"

IF DEBUG == ONE
PRINT_TEXT "This is the name of the attacker: <&TargeteeName&>"
ENDIF

IF TargeteeName == "#$<&CHAR_NAME&>"
IF DEBUG == ONE
PRINT_TEXT "seems like this packet is from ourselves attacking, not replying to this"
ENDIF
RETURN VOID
ENDIF

IF TargeteeName == "#$-nobody-"
IF DEBUG == ONE
PRINT_TEXT "This is a mob attacking, no need to reply"
ENDIF
RETURN VOID
ENDIF

IF DEBUG == ONE
PRINT_TEXT "attack coming from:<&p_MSU_source_id2&> Hitting: <&p_MSU_target_id2&>"
ENDIF

IF ENABLESOUND3 == ONE
IF DEBUG == ONE
PRINT_TEXT "Melee function alarm activated!"
ENDIF
PLAYALARM
ENDIF

IF LASTID == p_MSU_source_id2
IF DEBUG == ONE
PRINT_TEXT "Hey, thats the same person trying to get us to talk again! What a douche."
ENDIF
IF ENABLESOUND2 == ONE
IF DEBUG == ONE
PRINT_TEXT "ENABLESOUND2 is ringing!"
ENDIF
PLAYALARM
ENDIF
ENDIF

IF p_MSU_target_id2 == CHAR_ID
LASTID = p_MSU_source_id2
TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF
IF DEBUG == ONE
PRINT_TEXT "We are getting hit with melee or ranged."
PRINT_TEXT "Our char ID = <&CHAR_ID&>"
ENDIF
CALLSUB TALKBACK
ENDIF

RETURN VOID

//
//FUNCTION SkillUser
//

FUNCTION SkillUser
IF DEBUG == ONE
PRINT_TEXT "in SkillUser function"
ENDIF

DEFINE INT p_MSU_packet_type 0
DEFINE INT p_MSU_source_id 0
DEFINE INT p_MSU_target_id 0
DEFINE INT p_MSU_skill_id 0
DEFINE INT p_MSU_skill_level 0
DEFINE INT p_MSU_hit_time 0
DEFINE INT p_MSU_reuse_delay 0

PACKET.READ_BYTE p_MSU_packet_type
PACKET.READ_INT32 p_MSU_source_id
PACKET.READ_INT32 p_MSU_target_id
PACKET.READ_INT32 p_MSU_skill_id
PACKET.READ_INT32 p_MSU_skill_level
PACKET.READ_INT32 p_MSU_hit_time
PACKET.READ_INT32 p_MSU_reuse_delay

DEFINE STRING TargeteeName ""
CHAR_GET_NAME TargeteeName "<&p_MSU_source_id&>"

IF DEBUG == ONE
PRINT_TEXT "This is the name of the attacker: <&TargeteeName&>"
ENDIF

IF TargeteeName == "#$<&CHAR_NAME&>"
IF DEBUG == ONE
PRINT_TEXT "seems like this packet is from ourselves attacking, not replying to this"
ENDIF
RETURN VOID
ENDIF

IF TargeteeName == "#$-nobody-"
IF DEBUG == ONE
PRINT_TEXT "This is a mob attacking, no need to reply"
ENDIF
RETURN VOID
ENDIF

IF ENABLESOUND3 == ONE
IF DEBUG == ONE
PRINT_TEXT "Skill function alarm activated!"
ENDIF
PLAYALARM
ENDIF

IF DEBUG == ONE
PRINT_TEXT "Who the caster is targetting: ID = <&p_MSU_target_id&>"
ENDIF

IF LASTID == p_MSU_source_id
IF DEBUG == ONE
PRINT_TEXT "Hey, thats the same person trying to get us to talk again! What a douche."
ENDIF
IF ENABLESOUND2 == ONE
PLAYALARM
ENDIF
ENDIF

IF p_MSU_target_id == CHAR_ID
LASTID = p_MSU_source_id
TimeCalc1 = GLOBALTIMER - TimeCalc
IF TimeCalc1 < DelayBetweenMessages
IF DEBUG == ONE
PRINT_TEXT "Can't be spamming like crazy. User set time until next message can be sent:<&DelayBetweenMessages&> and current time: <&TimeCalc1&>"
ENDIF
RETURN VOID
ENDIF

IF DEBUG == ONE
PRINT_TEXT "We are getting casted on with magic by <&p_MSU_source_id&> in <&p_MSU_hit_time&> Milliseconds"
PRINT_TEXT "Our char ID = <&CHAR_ID&>"
ENDIF
CALLSUB SKILLWATCHFORCANCEL
ENDIF
RETURN VOID

//
//Fucntion SkillCanceled
//

FUNCTION SkillCanceled
IF DEBUG == ONE
PRINT_TEXT "in SkillCanceled function"
ENDIF
DEFINE INT p_MSU_packet_type2 0
DEFINE INT p_MSU_source_id2 0

PACKET.READ_BYTE p_MSU_packet_type2
PACKET.READ_INT32 p_MSU_source_id2

IF DEBUG == ONE
PRINT_TEXT "<&p_MSU_source_id2&>"
ENDIF

IF LASTID == p_MSU_source_id2
IF DEBUG == ONE
PRINT_TEXT "User stopped his cast! We wont say anything!"
ENDIF
DONOTTALK = ONE
ENDIF
RETURN VOID

FUNCTION NOTHING
IF DEBUG == ONE
PRINT_TEXT "Function NOTHING fired up"
ENDIF
//does nothing
RETURN VOID

************************************************************************************************************
***************************************SUBS**************************************************************
************************************************************************************************************

SUB REPLYNOW

//
//Pre message-code, do not touch unless you know what your doing.
//
IF DEBUG == ONE
PRINT_TEXT "in REPLYNOW sub"
ENDIF


IF TYPEMESSAGE == CHANNEL_PRIVATE
IsItPrivate = ONE
IF DEBUG == ONE
PRINT_TEXT "ITS A PRIVATE MESSAGE"
ENDIF
ELSE
IsItPrivate = ZERO
IF DEBUG == ONE
PRINT_TEXT "ITS NOT A PRIVATE MESSAGE"
ENDIF
ENDIF


SWITCH TYPEMESSAGE
CASE #i0
IF CHAN0 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i0
BREAK 1
CASE #i1
IF CHAN1 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i1
BREAK 1
CASE #i2
IF CHAN2 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i2
BREAK 1
CASE #i3
IF CHAN3 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i3
BREAK 1
CASE #i4
IF CHAN4 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i4
BREAK 1
CASE #i5
IF CHAN5 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i5
BREAK 1
CASE #i6
IF CHAN6 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i6
BREAK 1
CASE #i7
IF CHAN7 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i7
BREAK 1
CASE #i8
IF CHAN8 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i8
BREAK 1
CASE #i9
IF CHAN9 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i9
BREAK 1
CASE #i10
IF CHAN10 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i10
BREAK 1
CASE #i11
IF CHAN11 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i11
BREAK 1
CASE #i15
IF CHAN15 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i15
BREAK 1
CASE #i16
IF CHAN16 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i16
BREAK 1
CASE #i17
IF CHAN17 != #i1
RETURNSUB
ENDIF
MESSAGEVAR = #i17
BREAK 1
DEFAULT
RETURNSUB
BREAK 1
ENDSWITCH

//
//END of pre-message code
//

IF DEBUG == ONE
PRINT_TEXT "<&MESSAGEVAR&>"
ENDIF

FOREACH W string STRINGREPLY
STRCURRENT = "#$<&STRINGREPLY.W&>"
SAVELIST = PHRASEReply.W
MESSAGEREPLY = "#$SAVELIST.PhraseToSay"
HowManyLines = SAVELIST.COUNT
GET_RAND PhraseToSay 0 "<&HowManyLines&>"

IF DEBUG == ONE
PRINT_TEXT "HowManyLines = <&HowManyLines&>"
PRINT_TEXT "MESSAGEREPLY = <&MESSAGEREPLY&>"
PRINT_TEXT "STRCURRENT = <&STRCURRENT&>"
ENDIF

IF "MESSAGELOWER.CONTAINS #$<&STRCURRENT&>" == TRUE
SLEEP 500
IF IsItPrivate == ONE
SLEEP_HUMAN_READING "<&MESSAGE&>"
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY&>"
TimeCalc = GLOBALTIMER
SAY_TEXT "<&MESSAGEVAR&>" "<&<&MESSAGEREPLY&>&>" "<&SENDERNAME&>"
RETURNSUB
ELSE
SLEEP_HUMAN_READING "<&MESSAGE&>"
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY&>"
TimeCalc = GLOBALTIMER
SAY_TEXT "<&MESSAGEVAR&>" "<&<&MESSAGEREPLY&>&>"
RETURNSUB
ENDIF
ENDIF
NEXTEACH
RETURNSUB


//
//SUB SKILLWATCHFORCANCEL
//

SUB SKILLWATCHFORCANCEL
LOCK SkillUser
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" SkillCanceled 73
SLEEP "<&p_MSU_hit_time&>"
SET_EVENT "<&SCRIPTEVENT_SERVERPACKET&>" "<&SYSTEM_CURRENTFILE&>" NOTHING 73
UNLOCK SkillUser
CALLSUB TALKBACK
RETURNSUB

//
//SUB TALKBACK
//

SUB TALKBACK
IF DONOTTALK == ZERO
TimeCalc = GLOBALTIMER
HowManyLines2 = "AttackReply.COUNT"
GET_RAND PhraseToSay2 0 "<&HowManyLines2&>"
MESSAGEREPLY2 = "#$AttackReply.PhraseToSay2"
SLEEP 2000
SLEEP_HUMAN_WRITING "<&MESSAGEREPLY2&>"
SAY_TEXT "CHANNEL_ALL" "<&<&MESSAGEREPLY2&>&>"
IF DEBUG == ONE
PRINT_TEXT "SENT MESSAGE!"
ENDIF
ELSE
IF DEBUG == ONE
PRINT_TEXT "Fucker canceled his skill, trying to see if were bots, not replying."
ENDIF
ENDIF
DONOTTALK = ZERO
RETURNSUB

RETURN VOID

 

 

EXAMPLE OF INCLUDE VERSION

//Put this at the beginning of your script
THREAD AUTOREPLY

WHILE ZERO == ZERO
//
//This is normally where you would enter your script
//
SLEEP 1000
SAY_TEXT "This is a test"
WEND

//Put this at the end of one of your scripts
FUNCTION AUTOREPLY
CALL_EXTERN "INCLUDE/autoreplyCALLEXTERN.l2s" REPLYSCRIPTSET VOID 23 #i0 #i13 #i1 #i1 #i1 #i1 #i1 #i1 #i1 #i1 #i1 #i0 #i0 #i0 #i0 #i1 #i0 #i0 #i0 #i0 #i0 #i0 #i0
PRINT_TEXT "SCRIPT ENDED"
RETURN VOID
END_SCRIPT

  • 1 month later...
Posted

finally somebody tried it... Well, I have one thing I need to fix but since nobody was using it, I never bothered to. Guess I'm ganna have to do it now :)

  • 2 weeks later...
  • 6 months later...
  • 4 weeks later...
  • 5 months later...
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...