ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Tutorials => Topic started by: Cerveza on July 24, 2009, 07:11:36 AM

Title: The Process - Making a script.
Post by: Cerveza on July 24, 2009, 07:11:36 AM
Ok, no tutorials in a while... I'm going to write a quick, down and dirty animal evaluator based on barding difficulty.

Whenever I start to write something I do a LOT of research.

I need to find out what makes up the barding difficulty... there's a formula somewhere that explains it and I'll find that formula, build a spreadsheet with the numbers from the desirable tames list, then figure out the min/max barding difficulty based on the animals numbers.

Once I have that data, I can start to put together a script.

Now... how the script will function. I like to lay it out first.

1 - Setup (if required)
2 - On button
3 - Use skill animal lore on the target
4 - Use Kals OCR on the lore gump to get the barding difficulty (BD)
5 - Compare the current animals BD to the min/max BD and give it a percentage
6 - Display that percentage above the animals head (hehe)

I can start to build the script now, even without all the data needed.

Code: [Select]
;set %lore_gumpX -110
set %lore_gumpY 565
set %kal_gumpX -80
set %kal_gumpY 550

set %Bake_Kitsune EH
set %Cu_Sidhe FN
set %Dragon DF_CD
set %Drake YE_XE
set %Fire_Beetle JJ
set %Fire_Steed YJ
set %Frenzied_Ostard KG
set %Giant_Beetle ZGB
set %Greater_Dragon DF_CD
set %Hiryu HH
set %Ki_rin SH
set %Lesser_Hiryu HH
set %Nightmare EC_UJ_TJ
set %Reptalon GN
set %Rune_Beetle CH
set %Swamp_Dragon MHB
set %Unicorn SC
set %White_Wyrm OJ_TE

********** Main Loop **********
SUO:
repeat
  if #MENUBUTTON = Next
  {
    set #nextCposx %lore_gumpX
    set #nextCposy %lore_gumpY
    gosub lore
    gosub ocr
    gosub calculations
    gosub display
    gosub cleanup
  }
until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo SUO

********** Subs **********
sub lore
  event macro 13 2
  target
  while #targcurs = 1
    wait 0
  wait 5
  finditem #ltargetid *
  gosub pet_type_info
  contpos %kal_gumpX %kal_gumpY
  wait 5
return

sub ocr
call kalocr.txt getLoreInfo 7 value %kal_gumpX %kal_gumpY
set %barding_difficulty !lore_value
return

sub calculations
;
return

sub display
event ExMsg %targetID 2 0 %barding_difficulty
return

sub cleanup
  gosub showEUOMenu1
  wait 5
  set #MENUBUTTON N/A
  gosub OffsetClick 347 366 r
return

********** Data **********