Author Topic: Formatting Message Boxes  (Read 5524 times)

0 Members and 1 Guest are viewing this topic.

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Formatting Message Boxes
« on: October 14, 2010, 09:38:57 PM »
0
Following what I could understand of EN's tutorial, I've crafted the following beginnings of a replacement to Guadah's Item ID Finder:

Code: [Select]
--
--Functions
--
function ENs_GetItemTypeFromItemID(nItemID)
  local nThisType = nil
  local nCnt = UO.ScanItems(true) -- visible only
  local nIndex = 0
  while nIndex < nCnt and nThisType == nil do
    local nID,nType,nKind,nContID,nX,nY,nZ,nStack,nRep,nCol = UO.GetItem(nIndex)
    if nID == nItemID then nThisType = nType end
    nIndex = nIndex + 1
    end
  return nThisType
end

function DetermineItemID(sMessage) --stolen from EN, like most of my stuff
  UO.LTargetKind = 1 -- object
  UO.ExMsg(UO.CharID  , sMessage)  -- Message above character
  UO.TargCurs = true    -- make a target cursor
  while UO.TargCurs == true do  wait(10) end     -- wait until something is clicked (ie notarget cursor)
  UO.LObjectID = UO.LTargetID    -- set last object to the object clicked
  return  UO.LTargetID  -- set the return value .. the itemid clicked
end

function msgbox(default, prompt, title, button, icon)
  -- Function By Traegon's, Link: http://www.easyuo.com/forum/viewtopic.php?p=376784#376784
  if icon == nil then icon = 2 end
  if default == true then default = 1 else default = 0 end
 
  ConfirmDialog = Obj.Create("TMessageBox")
  ConfirmDialog.Title = title
  ConfirmDialog.Button = button
  ConfirmDialog.Icon = icon
  ConfirmDialog.Default = default
  return ConfirmDialog.Show(prompt)
end

function MessageBox(sPrompt, sTitle, sType)
  if sType == 'OK'    then  return msgbox(true, sPrompt, sTitle, 0,4) end
  if sType == 'YESNO' then  return msgbox(true, sPrompt, sTitle, 4,3) end
end

--
--Script begin
--
repeat
  local nMysteryItem = DetermineItemID('Target the item you wish to ID:')
  local nItemType = ENs_GetItemTypeFromItemID(UO.LTargetID)
  local nResult = MessageBox( 'Item Type is: ' .. nItemType .. '.  Identify another item?', 'NObama was here', 'YESNO')
until nResult == 7 --no

Run it.  See the message box?  How can I do the following:

1 - Add carriage returns to the output, so I can have multiple lines of information displayed in an easy-to-read format?
2 - How can I parse out actual names of items?

My thought is to display something along these lines:

Item Type Is:  XXXX
Item Name Is:  XXXX
.
.
.

What say you, smart people?

Scrripty

  • Guest
Re: Formatting Message Boxes
« Reply #1 on: October 14, 2010, 10:25:50 PM »
0
That works good.  Something you might want to do, is add a way to select what client you want to run the script on.  Very easy, also, if you use TM's finditem, you can return either EUO or OEUO item types and ids I believe... I haven't used it but I think he has that ability in there... might be a nice feature to return both.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Formatting Message Boxes
« Reply #2 on: October 14, 2010, 10:54:45 PM »
0
Here's the version with both OEUO and EUO numbers: Remember to save this to a file!!!

Code: [Select]
dofile("tm_subs_collection8.lua")
---------------------------------------------------------------
function CheckHotKey()
  if getkey("f1") and getkey('alt') then
    return true
  end
  return false
end
---------------------------------------------------------------
targetkey = false
repeat
  if CheckHotKey() then
    UO.TargCurs = true
    UO.LTargetKind = 1
    while UO.TargCurs == true do end
    print(UO.LTargetID)
    count, temp = TM_FindItemsByID(UO.LTargetID)
    if count > 0 then
      print("--------------------------------")
      print(string.format("FINDID = %d, in EUO = %s", temp[1].findid, TM_IDtoEUO(temp[1].findid)))
      print(string.format("findtype = %d in EUO = %s", temp[1].findtype, TM_IDtoEUO(temp[1].findtype)))
      print(string.format("findkind = %d", temp[1].findkind))
      print(string.format("contid = %d", temp[1].findid))
      print(string.format("findx = %d", temp[1].findx))
      print(string.format("findy = %d", temp[1].findy))
      print(string.format("findz = %d", temp[1].findz))
      print(string.format("findstack = %d", temp[1].findstack))
      print(string.format("findrep = %d", temp[1].findrep))
      print(string.format("findcol = %d", temp[1].findcol))
      print(string.format("name = %s", temp[1].name))
      print(string.format("property = %s", temp[1].property))
    end
  end
until false  
« Last Edit: October 14, 2010, 10:56:24 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Formatting Message Boxes
« Reply #3 on: October 15, 2010, 07:42:12 AM »
0
Nice Script Nobamma

Carridge return is character 13.  as in:  string.char(13)

so try this no idea what will happen

Quote
local nResult = MessageBox( 'Item Type is: ' .. nItemType .. '.'..string.char(13)..' Identify another item?', 'NObama was here', 'YESNO')
« Last Edit: October 16, 2010, 06:51:35 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Formatting Message Boxes
« Reply #4 on: October 16, 2010, 06:46:53 AM »
0
string.char(13) works.  Thanks EN.  Still working on the rest.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Formatting Message Boxes
« Reply #5 on: October 16, 2010, 06:52:04 AM »
0
string.char(13) works.  Thanks EN.  Still working on the rest.

your welcome.. your picking it up fast.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Formatting Message Boxes
« Reply #6 on: October 16, 2010, 07:16:59 AM »
0
Then TM comes along and posts the master sub for what I'm stumbling toward...

 :P

Scrripty

  • Guest
Re: Formatting Message Boxes
« Reply #7 on: October 16, 2010, 08:02:57 AM »
0
I told you it's easy if you just play with it didn't I? :)

Offline NObamaTopic starter

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: Formatting Message Boxes
« Reply #8 on: October 18, 2010, 09:15:02 PM »
0
I told you it's easy if you just play with it didn't I? :)


Dirty.

Tags: