• Print

Author Topic: Question About POSITION ( Lua )  (Read 4736 times)

0 Members and 1 Guest are viewing this topic.

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Question About POSITION ( Lua )
« on: May 29, 2012, 04:08:35 pm »
hi , well i download a Time + Ranks and its awesome but my question is about this



you see there's 2 boxes and the rank imagen and the other the rank , time on etc.. and the code for all of this is this:

Code: Lua
  1.  
  2. --Outer box border
  3.                 draw.RoundedBox(8, x-7, 8, w+24,h*6+93, Color(150,150,150,255))
  4.                 --Outer box
  5.                 draw.RoundedBox(8, x-5, 10, w+20,h*6+89, Color(50,50,50,255))
  6.                
  7.                 --Rank image box
  8.                 draw.RoundedBox(8, x, 15, w+10, 74, Color(100,100,100,255))
  9.                 surface.SetTexture(PlayerRanks[CurSyncRank].BadgeMat)
  10.                 surface.SetDrawColor(255,255,255,255)
  11.                 surface.DrawTexturedRect(x+((w+10)/2)-32,20,64,64)
  12.                
  13.                 --Info box
  14.                 draw.RoundedBox(8, x,1y, w+10, h*6, Color(100,100,100,255))
  15.                 draw.SimpleText(msg[1], "DefaultSmall", x+5, y+5, Color(255,255,255,255))
  16.                 draw.SimpleText(msg[2], "DefaultSmall", x+5, y+h+7, Color(255,255,255,255))
  17.                 draw.SimpleText(msg[3], "DefaultSmall", x+7, y+h+41, Color(255,255,255,255))
  18.                
  19.                
  20.                 --Info box progress bar
  21.                 if not PlayerRanks[CurSyncRank+1] then return end;
  22.                 local rnum = PlayerRanks[CurSyncRank+1].Time - PlayerRanks[CurSyncRank].Time
  23.                 local plnum = CurSyncTime - PlayerRanks[CurSyncRank].Time
  24.                 local percent = plnum/rnum*100
  25.                 local size = (w-4)/100*percent
  26.                 local ypos = y+20+h
  27.                 draw.RoundedBox(4, x+4, ypos, w, 20, Color(150,150,150,255))
  28.  
  29.                 surface.SetDrawColor(30,30,30,255)
  30.                 surface.DrawRect(x+6,ypos+2,w-4,16)
  31.                
  32.                 surface.SetDrawColor(255,170,0,255)
  33.                 surface.DrawRect(x+6,ypos+2,size,16)
  34.                
  35.                 --Info box progress bar text
  36.                 msg = ToHoursMinutesSeconds(rnum-plnum)
  37.                 local w2,h2 = surface.GetTextSize(msg)
  38.                 local tx = (x+6+((w-4)/2))-(w2/2)
  39.                 local ty = (ypos+8)-(h2/4)
  40.                 draw.RoundedBox(4, tx-2, ty-1,w2+4,h2+1, Color(30,30,30,180))
  41.                 draw.SimpleText(msg, "DefaultSmall", tx, ty, Color(255,255,255,255))
  42.  
  43.  

The Question:

How i can delete the images code and adjus the box to the other box ( the second box )

Thanks ! =)

( i know that to delete the image's box i need to delete the Rank image box but that leave an space in grey without anything so how can i adjust the POSITION ( The Space )

That thing hehe thanks guys !

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Re: Question About POSITION ( Lua )
« Reply #1 on: May 29, 2012, 05:50:37 pm »
Well i Solve My Question for my own :D


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Question About POSITION ( Lua )
« Reply #2 on: May 29, 2012, 06:31:24 pm »
Good job! :)
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Question About POSITION ( Lua )
« Reply #3 on: May 29, 2012, 07:06:09 pm »
There you go! It looks good too. LUA isn't as hard as people make it out to be.

  • Print