Author Topic: Example Of Gui  (Read 2498 times)

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Example Of Gui
« 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";
« Last Edit: July 28, 2013, 08:38:13 am by Mido_Pop »



Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: Example Of Gui
« Reply #1 on: July 28, 2013, 01:21:41 am »
Too much timers, also..

Code: [Select]
NewTimer( "Example1", 0000, 1 );
Please fix it.

stormeus

  • No-Lifer
  • Developer
  • Full Member
  • *****
  • Posts: 112
  • Karma: +13/-2
    • View Profile
Re: Example Of Gui
« Reply #2 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

This would also be better off as a client message than a persistent GUI entity.
« Last Edit: July 28, 2013, 01:24:03 am by stormeus »
Quote
Morphine says:
    them LU devs ranting about how LU doesn't have client pickups
    while us VC:MPers don't have client anything
    ;_;

Stormeus Argo says:
    we have client crashes though
    ohohohohoho

Morphine says:
    LU DOESN'T HAVE THAT

Stormeus Argo says:
    LU - 0
    VC:MP - 1

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: Example Of Gui
« Reply #3 on: July 28, 2013, 08:39:09 am »
Too much timers, also..

Code: [Select]
NewTimer( "Example1", 0000, 1 );
Please fix it.
Done  :D



Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: Example Of Gui
« Reply #4 on: July 28, 2013, 03:20:09 pm »
Still, too much timers to accomplish the same task.

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: Example Of Gui
« Reply #5 on: July 28, 2013, 03:33:09 pm »
Still, too much timers to accomplish the same task.
What is The Problem With You Shadow ?  :(



Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: Example Of Gui
« Reply #6 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 :)
« Last Edit: July 28, 2013, 03:44:49 pm by Shadow. »

Mido_Pop

  • Full Member
  • ***
  • Posts: 168
  • Karma: +6/-20
  • The_Pops ( War )
    • View Profile
Re: Example Of Gui
« Reply #7 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. :-\



Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: Example Of Gui
« Reply #8 on: July 28, 2013, 03:49:30 pm »
Much timers = bad.

My solution doesn't require you to do 20 functions for 20 messages.
« Last Edit: August 02, 2013, 12:12:06 am by SugarD »

 

© Liberty Unleashed Team.