forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Multicolor support

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Jan 29, 2003 7:27 pm    Post subject: Multicolor support Reply with quote

Hello,

I've made a little script that makes it a lot easier to use colors in your scripts. It uses a kind of BBCode tag. Try it to see...
_______________________________________________________________________________________________________________________________________________
This shows how to use it, in a simple way...
Code:
rem Works with VDS 3 & 4
  DIALOG CREATE,Multicolor,-1,0,414,156
  DIALOG ADD,EDIT,EDIT1,2,2,308,120,"This text is [color=bBlack]black[/color], [color=Red]this one is [/color][color=bRed]red[/color], [color=Dkblue]and this one is [/color][color=bDkblue]blue[/color]...",,MULTI,WRAP,SCROLL
  DIALOG ADD,BUTTON,BUTTON1,2,314,98,94,Set
  DIALOG ADD,GROUP,GROUP1,132,2,408,20
  DIALOG ADD,BUTTON,BUTTON2,98,314,98,24,Remove
  DIALOG SHOW

rem You have to load this first, to load the colors...
gosub Multicolor Load

:Evloop
wait event
goto @event()

:Button1button
rem ---------------------------------------------------------
rem                   Use it like this:
rem    %%Multicolor = TEXTNAME|TOPPOS|LEFTPOS|VALUE
rem ---------------------------------------------------------
%%Multicolor = MULTICOLOR1|135|10|@dlgtext(edit1)
gosub Multicolor
rem ---------------------------------------------------------
goto Evloop

:Button2button
rem ---------------------------------------------------------
rem Use this to remove a Multicolor text:
rem ---------------------------------------------------------
%%Multicolor = MULTICOLOR1
gosub Multicolor Remove
rem ---------------------------------------------------------
goto evloop

:Close
exit

-------------------------------------
rem Include this in all your scripts:
-------------------------------------

:Multicolor
parse "%%Textname;%T;%L",%%Multicolor
%%Multicolor = @strdel(%%Multicolor,1,@sum(@len(%%Textname),@len(%T),@len(%L),3))
%%Textcounter = 0

repeat

if @equal(@substr(%%Multicolor,1,6),[color)
  %%Text = @substr(%%Multicolor,@sum(@pos(],%%Multicolor),1),@sum(@pos([/color],%%Multicolor),-1))
  %%Color = @substr(%%Multicolor,@sum(@pos(=,%%Multicolor),1),@sum(@pos(],%%Multicolor),-1))
  %%Multicolor = @strdel(%%Multicolor,1,@sum(@pos([/color],%%Multicolor),7))
  else
  if @greater(@pos([color,%%Multicolor),0)
    %%Text = @substr(%%Multicolor,1,@sum(@pos([color,%%Multicolor),-1))
    %%Multicolor = @strdel(%%Multicolor,1,@sum(@pos([color,%%Multicolor),-1))
   %%Color = "Black"
   else
    %%Text = @substr(%%Multicolor,1,@len(%%Multicolor))
    %%Multicolor = @strdel(%%Multicolor,1,@len(%%Multicolor))
   %%Color = "Black"
   end
  end

if @greater(%%Textcounter,0)
  dialog add,text,MULTICOLOR%%Textname@succ(%%Textcounter),@dlgpos(MULTICOLOR%%Textname%%Textcounter,T),@fadd(@dlgpos(MULTICOLOR%%Textname%%Textcounter,l),@dlgpos(MULTICOLOR%%Textname%%Textcounter,w)),,,%%Text,,%%Color
  else
  dialog add,text,MULTICOLOR%%Textname@succ(%%Textcounter),%T,%l,,,%%Text,,%%Color
  end
%%Textcounter = @succ(%%Textcounter)

until @equal(%%Multicolor,)

exit

:Multicolor Load
rem Just add your own styles here. You can use whatever you like. The
rem style's name is the thing you can use with [color=]. You can also use
rem Bold characters and other fonts...

  DIALOG ADD,STYLE,BLACK,,,,BACKGROUND,BLACK
  DIALOG ADD,STYLE,DKBLUE,,,,BACKGROUND,DKBLUE
  DIALOG ADD,STYLE,RED,,,,BACKGROUND,RED
 
  DIALOG ADD,STYLE,bBLACK,,,B,,BLACK
  DIALOG ADD,STYLE,bDKBLUE,,,B,,DKBLUE
  DIALOG ADD,STYLE,bRED,,,B,,RED

  DIALOG ADD,STYLE,iBLACK,,,I,,BLACK
  DIALOG ADD,STYLE,iDKBLUE,,,I,,DKBLUE
  DIALOG ADD,STYLE,iRED,,,I,,RED
exit

:Multicolor Remove
  %%Textcounter = 1
  repeat
  dialog remove,MULTICOLOR%%Multicolor%%Textcounter
  %%Textcounter = @succ(%%Textcounter)
  until @greater(@dlgpos(MULTICOLOR%%Multicolor%%Textcounter,T),1200)
exit




This is just a little example of what you can make...
Code:
rem Works with VDS 3 & 4
  DIALOG CREATE,Multicolor Example,-1,0,320,60
  DIALOG SHOW
gosub Multicolor Load

%%Multicolor = TEXT1|6|130|[color=bRed]WARNING!!![/color]
gosub Multicolor
%%Multicolor = TEXT2|23|100|There has been an [color=bBlack]error[/color].
gosub Multicolor
%%Multicolor = TEXT3|40|10|[color=iDkblue]It is recommanded to[/color][color=bRed]save[/color][color=iDkblue]all your work and close[/color][color=bBlack]Windows[/color]
gosub Multicolor

:Evloop
wait event
goto @event()

:Close
exit

-------------------------------------
rem Include this in all your scripts:
-------------------------------------

:Multicolor
parse "%%Textname;%T;%L",%%Multicolor
%%Multicolor = @strdel(%%Multicolor,1,@sum(@len(%%Textname),@len(%T),@len(%L),3))
%%Textcounter = 0

repeat

if @equal(@substr(%%Multicolor,1,6),[color)
  %%Text = @substr(%%Multicolor,@sum(@pos(],%%Multicolor),1),@sum(@pos([/color],%%Multicolor),-1))
  %%Color = @substr(%%Multicolor,@sum(@pos(=,%%Multicolor),1),@sum(@pos(],%%Multicolor),-1))
  %%Multicolor = @strdel(%%Multicolor,1,@sum(@pos([/color],%%Multicolor),7))
  else
  if @greater(@pos([color,%%Multicolor),0)
    %%Text = @substr(%%Multicolor,1,@sum(@pos([color,%%Multicolor),-1))
    %%Multicolor = @strdel(%%Multicolor,1,@sum(@pos([color,%%Multicolor),-1))
   %%Color = "Black"
   else
    %%Text = @substr(%%Multicolor,1,@len(%%Multicolor))
    %%Multicolor = @strdel(%%Multicolor,1,@len(%%Multicolor))
   %%Color = "Black"
   end
  end

if @greater(%%Textcounter,0)
  dialog add,text,MULTICOLOR%%Textname@succ(%%Textcounter),@dlgpos(MULTICOLOR%%Textname%%Textcounter,T),@fadd(@dlgpos(MULTICOLOR%%Textname%%Textcounter,l),@dlgpos(MULTICOLOR%%Textname%%Textcounter,w)),,,%%Text,,%%Color
  else
  dialog add,text,MULTICOLOR%%Textname@succ(%%Textcounter),%T,%l,,,%%Text,,%%Color
  end
%%Textcounter = @succ(%%Textcounter)

until @equal(%%Multicolor,)

exit

:Multicolor Load
rem Just add your own styles here. You can use whatever you like. The
rem style's name is the thing you can use with [color=]. You can also use
rem Bold characters and other fonts...

  DIALOG ADD,STYLE,BLACK,,,,BACKGROUND,BLACK
  DIALOG ADD,STYLE,DKBLUE,,,,BACKGROUND,DKBLUE
  DIALOG ADD,STYLE,RED,,,,BACKGROUND,RED
 
  DIALOG ADD,STYLE,bBLACK,,,B,,BLACK
  DIALOG ADD,STYLE,bDKBLUE,,,B,,DKBLUE
  DIALOG ADD,STYLE,bRED,,,B,,RED

  DIALOG ADD,STYLE,iBLACK,,,I,,BLACK
  DIALOG ADD,STYLE,iDKBLUE,,,I,,DKBLUE
  DIALOG ADD,STYLE,iRED,,,I,,RED
exit

:Multicolor Remove
  %%Textcounter = 1
  repeat
  dialog remove,MULTICOLOR%%Multicolor%%Textcounter
  %%Textcounter = @succ(%%Textcounter)
  until @greater(@dlgpos(MULTICOLOR%%Multicolor%%Textcounter,T),1200)
exit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group