Author Topic: How do you get a target cursor in Stealth?  (Read 4086 times)

0 Members and 1 Guest are viewing this topic.

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
How do you get a target cursor in Stealth?
« on: November 08, 2013, 07:34:13 PM »
0
In my easyuo scripts I like to use the cursor to get the ID of an item I plan to use.  An example of the code I usually use is:
Code: [Select]
set #TARGCURS 1
target ;wait 3s for target cursor to appear
; loop until the player targets an item
while #TARGCURS = 1
    wait 0
; save the id into %myvar
set %myvar #LTARGETID

How would you write similar code in Stealth?
Started playing back at the Second Age

Offline Orich

  • Jr. Member
  • **
  • Posts: 77
  • Activity:
    0%
  • Reputation Power: 3
  • Orich has no influence.
  • Respect: +12
  • Referrals: 1
    • View Profile
Re: How do you get a target cursor in Stealth?
« Reply #1 on: November 08, 2013, 07:43:37 PM »
0
I encourage you to peruse through the C# script tutorial.  It goes over this ... but here are two examples :


1.  Bring up a local client target, get an object ID


Using ScriptAPI.cs
Code: [Select]
   Item Result = Target.RequestTarget();

Using ScriptDotNet.DLL Normal API :
Code: [Select]
   Stealth.Script_ClientRequestObjectTarget(); // This brings up a target cursor in Client.exe

   while(Stealth.Script_ClientTargetResponsePresent() == false) // while Client.exe does NOT have a target
      Stealth.Script_Wait(100); // Wait 100ms, then loop

   var ChosenTarget = Stealth.Script_ClientTargetResponse(); // This function returns a TTargetInfo object with ID, Tile, X, Y, Z


Now, in those two examples this is bringing up a "Virtual Target" ... Meaning, we are requesting a target in Client.exe, but it will never send the result back to the game server.  This is a local interaction between Stealth and the Client.exe

If, say, you wanted to cast a spell and wait for the server's target :


Code: [Select]
   Stealth.Script_CastSpell("Greater Heal");  // same as Self.Cast()
   
   Stealth.Script_WaitForTarget(10000); // Wait for target to appear, timeout after 10,000 milliseconds (10 seconds)
   uint LastTarget = Stealth.Script_GetLastTarget();
Member of the Stealth development team.
Author of Stealth .NET DLL

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: How do you get a target cursor in Stealth?
« Reply #2 on: November 09, 2013, 07:51:57 AM »
0
Excellent examples, thank you!

For reference, I found the point in the video tutorial that you describe the bag setup.  Also, the ChooseBag function starts on line 43 in Program.cs from the C# tutorial.

Thanks again,
S
Started playing back at the Second Age

Tags: