Author Topic: {c#} Events in 9.2 sdk and scriptdotnet2.ll  (Read 3321 times)

0 Members and 1 Guest are viewing this topic.

Offline epsilon2Topic starter

  • Jr. Member
  • **
  • Posts: 36
  • Activity:
    0%
  • Reputation Power: 1
  • epsilon2 has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
{c#} Events in 9.2 sdk and scriptdotnet2.ll
« on: March 11, 2016, 09:19:30 AM »
0
hello,

i have some problems to register some events in c#.
For now i want to use the OnMenue Event and OnGumpIncome Event.
As I understand, the On Menue Event will be fired when the ContextMenue ist shown.
The OnGumpIncome is hopefully able to parse and awenser to an opened gump.

I have the following code and dont know how how to register the function.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScriptSDK;
using ScriptSDK.API;
using ScriptSDK.Attributes;
using ScriptSDK.Configuration;
using ScriptSDK.ContextMenus;
using ScriptSDK.Data;
using ScriptSDK.Engines;
using ScriptSDK.Gumps;
using ScriptSDK.Items;
using ScriptSDK.Mobiles;
using ScriptSDK.Targets;
using ScriptSDK.Utils;
using ScriptDotNet2;
using System.Threading;

namespace Event
{
    class Program
    {
        static void OnMenuHandler(uint DialogID, ushort MenuID)
        {
            
            Console.WriteLine("Menue Opened");
        }

        private static void TimerCallback(Object o)
        {
            Console.WriteLine("In TimerCallback: " + DateTime.Now);
            GC.Collect();
        }


        static void Main(string[] args)
        {
            Console.WriteLine("Program Started");
            ScriptSDK.OnMenuEvent += OnMenuHandler;
            ScriptDotNet2.Stealth.Script_EnableEvent(TPacketEvent.evMenu);
            Timer t = new Timer(TimerCallback, null, 0, 1000);
            Console.WriteLine("Waiting for event fire, Press any key to stop");
            Console.ReadKey();
        }
    }
}


regards

Tags: