16
Stealth archive / Stealth 6.1.5
« on: December 08, 2013, 05:40:42 PM »
C# script cannot run after update to 6.1.5...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Stealth.Script_SetFindDistance(255);
Stealth.Script_SetFindVertical(255);
List<uint> _creature = new List<uint>();
for (byte i = 1; i <= 7; i++)
{
Stealth.Script_FindNotoriety(0xffff, i);
Console.WriteLine("Notoriety : {0} , Found : {1} , Found List : {2} ", i, Stealth.Script_GetFindCount(), Stealth.Script_GetFindList().Length);
}
uint _id = 0x01E42449;
Console.WriteLine("Player Vendoer Notoriety : {0}", Stealth.Script_GetNotoriety(_id));
Stealth.Script_FindNotoriety(Stealth.Script_GetType(_id), Stealth.Script_GetNotoriety(_id));
Console.WriteLine("Find Notoriety Count : {0}", Stealth.Script_GetFindCount());
_id = Stealth.Script_GetSelfID();
Console.WriteLine("Self Notoriety : {0}", Stealth.Script_GetNotoriety(_id));
Stealth.Script_FindNotoriety(Stealth.Script_GetType(_id), Stealth.Script_GetNotoriety(_id));
Console.WriteLine("Find Notoriety Count : {0}", Stealth.Script_GetFindCount());
Console.ReadLine();
Stealth.Script_SetFindDistance(50);
Stealth.Script_SetFindVertical(255);
Stealth.Script_FindType(0xffff, 0x0);
List<uint> _findlist = new List<uint>(Stealth.Script_GetFindList());
List<uint> _creature = new List<uint>();
Console.WriteLine(DateTime.Now);
foreach (uint i in _findlist)
{
// The problem seems in here..
if ( Stealth.Script_GetNotoriety(i) > 0 ){
_creature.Add(i);
}
}
Console.WriteLine(DateTime.Now);
Console.WriteLine("Total NPC:{0}", _creature.Count);
Console.WriteLine("Total FindItem:{0}", _findlist.Count);
It use 2 seconds to filter the result...
Stealth.Script_SetFindDistance(2);
Stealth.Script_FindType(0xffff, 0x0000);
List<uint> _findlist = new List<uint>(Stealth.Script_GetFindList());
foreach (uint i in _findlist) { Console.WriteLine("{0:X}",i); }
Console.WriteLine("Total:{0}",_findlist.Count);
Console.ReadLine();
So..Is it bug on ScriptDotNet or something wrong on the script?Well you are right .. I remembered this from delphi.. Iam sorry..Do you use any Waits in your script? Because most events are only checked, when the script thread in stealth sleeps..
What? This isn't true at all for C#.
This is only true for Delphi.
Nice to have someone testing out C# methods.. You are the first one to do itOh..Thanks Orich.
These two functions :
Script_GetPathArray
and
Script_GetPathArray3D
I think they need a small fix in Stealth.exe. I will update you ASAP
TMyPoint[] _path = Stealth.Script_GetPathArray(1011, 513, false, 0);
Console.WriteLine(_path.Length);
// Result : 0;
I can use Stealth.Script_MoveXY to move to the location but i can't get the path array..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ScriptDotNet;
namespace Event
{
class Event
{
static void OnBuff_Debuff(uint ID, ushort Attribute_ID, bool IsEnabled)
{
String buffStatus = (IsEnabled) ? "Turned On" : "Turned Off";
String outputString = String.Format("Buff ID:{0} has just {1}", Attribute_ID, buffStatus);
Console.WriteLine(outputString);
}
private static void TimerCallback(Object o)
{
Console.WriteLine("In TimerCallback: " + DateTime.Now);
GC.Collect();
}
static void Main(string[] args)
{
Console.WriteLine("Program Started");
Stealth.OnBuff_DebuffSystemEvent += OnBuff_Debuff;
Stealth.Script_EnableEvent(TPacketEvent.evBuff_DebuffSystem);
Timer t = new Timer(TimerCallback, null, 0, 1000);
Console.WriteLine("Waiting for event fire, Press any key to stop");
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ScriptDotNet;
namespace Event
{
class Event
{
static void OnBuff_Debuff(uint ID, ushort Attribute_ID, bool IsEnabled)
{
String buffStatus = (IsEnabled) ? "Turned On" : "Turned Off";
String outputString = String.Format("Buff ID:{0} has just {1}", Attribute_ID, buffStatus);
Console.WriteLine(outputString);
}
static void OnTimer1()
{
Console.WriteLine("Timer 1 Event Fire");
}
static void OnTimer2()
{
Console.WriteLine("Timer 2 Event Fire");
}
static void OnSpeech(string str1,string str2, uint id)
{
Console.WriteLine("On Speech Event");
}
static void Main(string[] args)
{
Console.WriteLine("Program Started");
Stealth.OnBuff_DebuffSystemEvent += OnBuff_Debuff;
Stealth.Script_EnableEvent(TPacketEvent.evBuff_DebuffSystem);
Stealth.OnTimer1Event += OnTimer1;
Stealth.Script_EnableEvent(TPacketEvent.evTimer1);
Stealth.OnTimer2Event += OnTimer2;
Stealth.Script_EnableEvent(TPacketEvent.evTimer2);
Stealth.OnSpeechEvent += OnSpeech;
Console.WriteLine("Waiting for event fire, Press any key to stop");
Console.ReadKey();
}
}
}