;=================================================================
; Script Name: TrailMyx's Forum Item Info
; Author: TrailMyx
; Version: 1.0
; Shard OSI / FS: OSI / FS OK
; Revision Date: 9/29/2007
; Purpose: Summarizes an item property and formats this information to be posted on a forum such as ScriptUO.
;          Known to work on an SMF-powered forum
; Globals:
;=================================================================
; Disclaimer:  By running this script, you are accepting the contents of this licence agreement.
; This script is only authorized to be distributed on www.scriptuo.com  If you purchase this script,
; acquire it from another website, it is not considered an authorized copy and should be deleted
; immediately.
; You hold the author, TrailMyx, and the distribution site www.scriptuo.com not liable for any loss of
; items, accounts, monitary or time losses associated with the use of this script.  Furthermore, you promise
; not to distribute or sell this script to anyone without the express permission of the author, Trailmyx.
; Violation of the contents of this agreement will result in one of the following: litigation, www.scriptuo.com
; account termination, discimination of bad karma for your next life, and most definitely causing a black mark
; placed on your soul.
;
; I worked very hard to bring this script to you, so please use it responisibily and
; respectfully.  If you have any questions, please reach me at trailmyx@yahoo.com.
; (c) 2007 TrailMyx, All rights reserved.
;===================================================================
gosub showEUOMenu1
 
set #MENUBUTTON N/A
set #LPC 100
repeat
  if #MENUBUTTON = EUOButtonTarget
  {
    set #TARGCURS 1
    repeat
    until #TARGCURS = 0
    event property #LTARGETID
    gosub TM_AddSpace #PROPERTY
    gosub TM_SplitString #RESULT $
    gosub TM_SubstringCount
    set %lines #RESULT - 1
    set %bbc
    for %i 0 %lines
    {
      gosub TM_GetIndex %i
      set %bbc %bbc , [li] , #RESULT , [/li]
    }
    menu set EUOEditBBC %bbc
    set #MENUBUTTON N/A
  }
until #FALSE
;-------------------------------------------------------------------------------
sub TM_SplitString
  namespace push
  namespace local PS
  namespace clear
  set !string %1
  set !delimiter %2
  set !cnt 0
  str pos !string !delimiter
  repeat
    if #STRRES = 0
      break
    set !temp #STRRES - 1
    str left !string !temp
    set !array . !cnt #STRRES
    set !cnt !cnt + 1
    set !temp !temp + 1
    str del !string 1 !temp
    set !string #STRRES
    str pos !string !delimiter
  until #STRRES = 0
  set #RESULT !cnt
  namespace pop
return #RESULT
;-------------------------------------------------------------------------------
sub TM_GetIndex
  namespace push
  namespace local PS
  set !index %1
  set #RESULT !array . !index
  namespace pop
return #RESULT
;-------------------------------------------------------------------------------
sub TM_SubstringCount
  namespace push
  namespace local PS
  set #RESULT !cnt
  namespace pop
return #RESULT
;-------------------------------------------------------------------------------
; %1 - string to mung
sub TM_AddSpace
  namespace push
  namespace local AS
  set !tempstring %1
  AddSpace_loop1:
    str pos !tempstring _
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !tempstring !val
      set !left #STRRES
      set !val !val + 1
      str del !tempstring 1 !val
      set !tempstring !left , #SPC , #STRRES
      goto AddSpace_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT
 
;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
        menu Clear
        menu Window Title TrailMyx Item Property Poster
        menu Window Color BtnFace
        menu Window Size 324 50
        menu Font Transparent #true
        menu Font Align Right
        menu Font Name MS Sans Serif
        menu Font Size 8
        menu Font Style 
        menu Font Color WindowText
        menu Button EUOButtonTarget 132 4 75 25 Target
        menu Font BGColor Window
        menu Edit EUOEditBBC 8 32 305 
        menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------