ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: alaskan on September 18, 2014, 10:54:54 PM

Title: Trying to wrap my brain around the infamous STR command
Post by: alaskan on September 18, 2014, 10:54:54 PM
Not trying to step on any toes with this post and just in advanced I do use/love TM's CLAW script, one of the best looting scripts I've seen. For myself though I'm trying to get better with EUO in general and it seems I've still much to learn lol. Which brings me to this topic. I somewhat understand strings and how powerful they can be when used properly, especially in looting purposes. I've taken this sub that I found on the EUO website and tailored it a little for learning purposes. I've tested this sub and it works superb for evaluating the "sum" of the pre-sub variables (%1 %2 %3 etc. not sure if that's the correct terminology lol). I'm trying to only evaluate the intensity of one item for looting vs. the intensity sum of all the items. I will post this "modified" sub (credit was given where credit is due) and if someone wishes to see the full script I have no problem posting it. I just want to understand using the str command fully. Any and all help is much appreciated  :D.

Code: [Select]
gosub getprop blah blah blah
sub getprop

  ;This sub was written by JackD. I merely added modifications
  ;
  ;

  namespace push
  namespace local getprop
  set !0 %0
  set !1 %1
  set !2 %2
  set !3 %3
  if !0 > 0 && !1 <> N/A
  {
    finditem * C_ , %1 ; corpse from my script
    if #findcnt < 1
      return %total
    set !oldlpc #LPC
    set #LPC 10000
    set %total 0
    set !line % . !0               
    goto L , !0
L5:                                      ; Assuming this part stores blah and stores it into the string
    set !line !4 , #spc , !line
L4:
    set !line !3 , #spc , !line
L3:
    set !line !2 , #spc , !line
L2:
    set !line !1 , #spc , !line
L1:
    set !line $ , !line , #spc
    str len !line
    set %len #strRes
    for #findindex 1 #findcnt
    {
      event property #findid
      if !line in #property
      {
        str pos #property !line
        set %pos #strRes + %len
        str mid #property %pos 5
        set %prop #strRes
        str pos %prop $
        set %pos #strRes - 1
        str left %prop %pos
        set %tempval #strRes
        str pos %tempval %
        if #strRes > 1
        {
          set %pos #strRes - 1
          str left %tempval %pos
          set %tempval #strRes
        }
        set %total %total + %tempval           ; I believe this tallies up all the integers for blah
      }
    }
    set #LPC %oldlpc
    namespace clear
    namespace pop
    return %total
  }
  namespace clear
  namespace pop
return 0
Title: Re: Trying to wrap my brain around the infamous STR command
Post by: TrailMyx on September 19, 2014, 07:46:59 AM
The string explanation in their wiki and help sections over at EUO are pretty good.  That's where I learned...
Title: Re: Trying to wrap my brain around the infamous STR command
Post by: alaskan on September 19, 2014, 10:35:19 AM
Aye, lol guess I'll look over their tutorials a couple more times  :)