From Stealth Client

Jump to: navigation, search
 
Line 46: Line 46:
* evPartyInvite : [Inviter_ID : Cardinal] - some one is inviting us in party  
* evPartyInvite : [Inviter_ID : Cardinal] - some one is inviting us in party  
* evPartyInvite: [Inviter_ID : Dword] - приглашение на вступление в группу
* evPartyInvite: [Inviter_ID : Dword] - приглашение на вступление в группу
-
* evMapPin: [ID :Dword; Action, PinID : : Byte; X, Y : Word ] - помеченная точка на карте.  
+
* evMapPin: [ID :Dword; Action, PinID : : Byte; X, Y : Word ] - Marked point on map.  
-
* evGumpTextEntry: [fGumpTextEntryID : Dword; Title - String; InputStyle : Byte; MaxValue : Dword; Title2 : String] - Строка ввода, напоминающая гамп, но не он.
+
* evGumpTextEntry: [fGumpTextEntryID : Dword; Title - String; InputStyle : Byte; MaxValue : Dword; Title2 : String] - Strin Entry, look like gump, but really not.
-
* evGraphicalEffect: [_srcID: Cardinal; _srcX, _srcY: Word; _srcZ : SmallInt; _dstID : Cardinal; _dstX, _dstY: Word; _dstZ : Smallint; _type : Byte; _itemID: Word; _fixedDir: Byte] -граф. эффект.
+
* evGraphicalEffect: [_srcID: Cardinal; _srcX, _srcY: Word; _srcZ : SmallInt; _dstID : Cardinal; _dstX, _dstY: Word; _dstZ : Smallint; _type : Byte; _itemID: Word; _fixedDir: Byte] -Graphical Effect.
-
* evIRCIncomingText: [Message : String] - входящее сообщение из IRC
+
* evIRCIncomingText: [Message : String] - IRC incoming message
-
* evMessengerEvent: [Sender : TMessenger; SenderNickName : String; SenderId, ChatId : String; EventMsg : String; EventCode : Byte] - подробности в разделе Messengers.
+
* evMessengerEvent: [Sender : TMessenger; SenderNickName : String; SenderId, ChatId : String; EventMsg : String; EventCode : Byte] - more info in Messengers manual.
-
* evSetGlobalVar: [VarName: String; VarValue: String] - срабатывает при установке глобальной переменной через SetGlobal('stealth',VarName,VarValue)или из внешнего скрипта.
+
* evSetGlobalVar: [VarName: String; VarValue: String] - The event is triggered when global variable is set from SetGlobal('stealth',VarName,VarValue) or from external script.
-
* evUnicodeSpeech: устарел, больше не используется (использовать evSpeech).
+
* evUnicodeSpeech: deprecated, used no longer (use evSpeech).
-
* evClilocSpeechAffix: устарел, больше не используется (использовать evClilocSpeech).
+
* evClilocSpeechAffix: deprecated, used no longerя (use evClilocSpeech).
-
* evDrawGamePlayer: устарел, больше не используется (использовать evDrawObject).
+
* evDrawGamePlayer: deprecated, used no longer (use  evDrawObject).
-
* evUpdateChar: устарел, больше не используется (использовать evDrawObject).
+
* evUpdateChar: deprecated, used no longer (use evDrawObject).

Latest revision as of 13:10, 7 March 2018

Events

What events are.

To understand what events are consider a simple example: anti-macro gumps that appear in some shards. Typically, if for example you are crafting, while your macro is running the anti-macro gump can appear. In a normal macro you should check for the presence of the gump at every step, with events you can decentralize the check so that the gump can be handled independently while the main macro is running.

Another example where events may be useful is to check the state of connection in a separate place than the main script.

To create events you use the following syntax:

 SetEventProc(evSpeech,'function_name');

To empty events you need to specify an empty handler

SetEventProc(evSpeech,' ');

List of available events:

  • evItemInfo : [ID : Cardinal]
  • evItemDeleted : [ID : Cardinal]
  • evSpeech : [Text : String, SenderName : String, SenderID: Cardinal] - not Unicode message (packet 0x1C)
  • evDrawGamePlayer : [ID : Cardinal] - packet 0x20, is mainly used to draw our Chara, but not always
  • evMoveRejection : [Xorig, Yorig, Dir, XDest, YDest : Word] - server rejected the movement, not allowed to step
  • evDrawContainer : [ID, ModelGump : Cardinal] - drawing container (0x24 bag)
  • evAddItemToContainer : [ObjID, ContainerID : Cardinal]
  • evAddMultipleItemsInCont : [ContainerID : Cardinal] - packet 0x3c
  • evRejectMoveItem : [Reason] - ban drag \ drop
  • evUpdateChar : [ID : Cardinal] - drawing chara (not necessarily ours!)
  • evDrawObject : [ID : Cardinal] - drawing chara (not necessarily ours!)
  • evMenu : [DialogID : Cardinal, MenuID : Word] - a Menu popped out
  • evMapMessage : [ID, centerx, centery] - Treasure discovered
  • evAllow_RefuseAttack : [ID : Cardinal, Attack_OK : Boolean] (ID = 0 if Attack_OK = False)
  • evClilocSpeech : [SenderID : String, SenderName : String, ClilocID : Cardinal, Text : String]
  • evClilocSpeechAffix : [SenderID, SenderName : String, ClilocID : Cardinal, Affix, ClilocText : String]
  • evUnicodeSpeech : [Text,SenderName : String, SenderID : Cardinal] - Message in Unicode (package 0xAE)
  • evBuff_DebuffSystem : [ID : Cardinal, Attribute_ID : Word, IsEnabled : Boolean] - A (de)buff is (de)activated
  • evClientSendResync : [] - Stealth (or the client through it) sent resync
  • evCharAnimation : [ID : Cardinal, Action : Word]
  • evICQDisconnect : []
  • evICQConnect : []
  • evICQIncomingText : [uin, Text]
  • evICQError : [Text : String]
  • evIncomingGump : [Serial,GumpID,X,Y]
  • evTimer1 : [] - no settings, called every 100ms
  • evTimer2 : [] - no settings, called every 100ms
  • evWindowsMessage : [Dword]
  • evSound : [Sound_ID : Cardinal, X , Y, Z : Word] - sound and its coordinates
  • evDeath : [Dead : Boolean] - If True Dead, else alive
  • evQuestArrow : [fQuestArrowX, fQuestArrowY : Word, fQuestArrowActive : Boolean]
  • evPartyInvite : [Inviter_ID : Cardinal] - some one is inviting us in party
  • evPartyInvite: [Inviter_ID : Dword] - приглашение на вступление в группу
  • evMapPin: [ID :Dword; Action, PinID : : Byte; X, Y : Word ] - Marked point on map.
  • evGumpTextEntry: [fGumpTextEntryID : Dword; Title - String; InputStyle : Byte; MaxValue : Dword; Title2 : String] - Strin Entry, look like gump, but really not.
  • evGraphicalEffect: [_srcID: Cardinal; _srcX, _srcY: Word; _srcZ : SmallInt; _dstID : Cardinal; _dstX, _dstY: Word; _dstZ : Smallint; _type : Byte; _itemID: Word; _fixedDir: Byte] -Graphical Effect.
  • evIRCIncomingText: [Message : String] - IRC incoming message
  • evMessengerEvent: [Sender : TMessenger; SenderNickName : String; SenderId, ChatId : String; EventMsg : String; EventCode : Byte] - more info in Messengers manual.
  • evSetGlobalVar: [VarName: String; VarValue: String] - The event is triggered when global variable is set from SetGlobal('stealth',VarName,VarValue) or from external script.
  • evUnicodeSpeech: deprecated, used no longer (use evSpeech).
  • evClilocSpeechAffix: deprecated, used no longerя (use evClilocSpeech).
  • evDrawGamePlayer: deprecated, used no longer (use evDrawObject).
  • evUpdateChar: deprecated, used no longer (use evDrawObject).


Sample script

//Pascal Sample
Program Test; 
 
procedure Unicode_Speech(text,SenderName : String; SenderID : Cardinal); 
begin 
  AddToSystemJournal('Event! Unicode Speech: SenderID = $'+ IntToHex(SenderID,8) + ' ; SenderName =  ' + SenderName + '; SenderText : ' + text); 
end; 
 
procedure Char_Animation(ID : Cardinal; Action : Word); 
begin 
  AddToSystemJournal('Event! Char Animation: ID = $'+ IntToHex(ID,8) + ' ; Action =  ' + IntToStr(Action)); 
end; 
 
procedure multiple_Items(ContainerID : Cardinal); 
begin 
  AddToSystemJournal('Event! Add multiple Items In Cont: ContID = $'+ IntToHex(ContainerID,8)); 
end; 
 
begin 
  SetEventProc(evUnicodeSpeech,'Unicode_Speech'); 
  SetEventProc(evCharAnimation,'Char_Animation'); 
  SetEventProc(evAddMultipleItemsInCont,'multiple_Items'); 
 
  while True do 
    wait(50); 
end.
# Python sample
ICQuin = "123456789"
ICQPass = "p4ssw0rd"
 
def OnICQError(text):
	AddToSystemJournal('ICQ Error: ' + text)
 
def OnICQIncomingText(uin, text):
	AddToSystemJournal('Message from %s: %s' % (uin, text))
	ICQSendText(str(uin), "Recived!")
 
# ICQ Connection
if not ICQConnected():
	ICQConnect(ICQuin, ICQPass)
while not ICQConnected():
	Wait(200)
ICQSendText(ICQToUIN, "Connection established!")
 
# ICQ Events
SetEventProc(evICQError, OnICQError)
SetEventProc(evICQIncomingText, OnICQIncomingText)
 
while True:
	Wait(50)