Liberty Unleashed

Scripting => Script Releases => Topic started by: Mido_Pop on July 28, 2013, 12:42:42 am

Title: Example Of Gui
Post by: Mido_Pop on July 28, 2013, 12:42:42 am
Hey, This Script For Noobs Players Only  ;D.
This Is An Example Of Gui Info By Timers >>
Code: [Select]
function onScriptLoad()
{
   local nPos = VectorScreen( 11, ScreenHeight - 25 );
   
   local nSize = ScreenSize( 100,3 );
   
   nText <- GUILabel( nPos, nSize, "" );
   
   nText.FontName = "Cambria";
   
   nText.FontSize = 12;
   
   AddGUILayer( nText );

   nText.Text = "Example1";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "Example2", 10000, 1 );
}

function Example2()
{
   nText.Text = "Example2";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "Example3", 10000, 1 );
}

function Example3()
{
   nText.Text = "Example3";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "Example4", 10000, 1 );
}

function Example4()
{
   nText.Text = "Example4";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "Example5", 10000, 1 );
}

function Example5()
{
   nText.Text = "Example5";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "Example1", 10000, 1 );
}

Change The ( Example ) To Any Text Do You Need, Like This >
Code: [Select]
   nText.Text = "Kill Any One xD";
(http://img96.imageshack.us/img96/4899/l56p.png)
Title: Re: Example Of Gui
Post by: Shadow. on July 28, 2013, 01:21:41 am
Too much timers, also..

Code: [Select]
NewTimer( "Example1", 0000, 1 );
Please fix it.
Title: Re: Example Of Gui
Post by: stormeus on July 28, 2013, 01:22:15 am
Looks good aside from the invalid interval in the first timer (interval: 0), but please read this:
http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=1245.msg7783#msg7783 (http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=1245.msg7783#msg7783)

This would also be better off as a client message than a persistent GUI entity.
Title: Re: Example Of Gui
Post by: Mido_Pop on July 28, 2013, 08:39:09 am
Too much timers, also..

Code: [Select]
NewTimer( "Example1", 0000, 1 );
Please fix it.
Done  :D
Title: Re: Example Of Gui
Post by: Shadow. on July 28, 2013, 03:20:09 pm
Still, too much timers to accomplish the same task.
Title: Re: Example Of Gui
Post by: Mido_Pop on July 28, 2013, 03:33:09 pm
Still, too much timers to accomplish the same task.
What is The Problem With You Shadow ?  :(
Title: Re: Example Of Gui
Post by: Shadow. on July 28, 2013, 03:42:30 pm
My problem is that you encourage new scripters to use timers which is not good, also, your timer usage is not good.

Take a look:

Code: [Select]
function onScriptLoad()
{
   local nPos = VectorScreen( 11, ScreenHeight - 25 );
   
   local nSize = ScreenSize( 100,3 );
   
   nText <- GUILabel( nPos, nSize, "" );
   
   nText.FontName = "Cambria";
   
   nText.FontSize = 12;
   
   AddGUILayer( nText );

   nText.Text = "Example1";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "TextUpdater", 10000, 0 );
}

random_msg <- [
              "message1",
              "message2",
              "message3", // add how many you want
];

function TextUpdater()
{
         nText.Text = random_msg[ rand() % random_msg.len() ];
}

See how easy I made everything.
Fixed it for you :)
Title: Re: Example Of Gui
Post by: Mido_Pop on July 28, 2013, 03:48:29 pm
My problem is that you encourage new scripters to use timers which is not good, also, your timer usage is not good.

Take a look:

Code: [Select]
function onScriptLoad()
{
   local nPos = VectorScreen( 11, ScreenHeight - 25 );
   
   local nSize = ScreenSize( 100,3 );
   
   nText <- GUILabel( nPos, nSize, "" );
   
   nText.FontName = "Cambria";
   
   nText.FontSize = 12;
   
   AddGUILayer( nText );

   nText.Text = "Example1";
   nText.TextColour = Colour( 255, 255, 255 );
   NewTimer( "TextUpdater", 10000, 0 );
}

random_msg <- [
              "message1",
              "message2",
              "message3", // add how many you want
];

function TextUpdater()
{
         nText.Text = random_msg[ rand() % random_msg.len() ];
}

See how easy I made everything.
Fixed it for you :)

Good Idea But The Timers Better Than This .
I Know It's Make A Crashes But It's Better. :-\
Title: Re: Example Of Gui
Post by: Shadow. on July 28, 2013, 03:49:30 pm
Much timers = bad.

My solution doesn't require you to do 20 functions for 20 messages.