Jump to content




How to make a splash screen.


  • This topic is locked This topic is locked
17 replies to this topic

#1 ZdecydowanieJa

  • New Members
  • 1 posts

Posted 13 August 2012 - 02:37 PM

Hello, this is my first post. I'll show you how to make a splash screen for your program.

1.Write function named "job" for loading program's settings etc. (make sure there isn't any prints and something else that showing something on screen)
function job()
  --some loading stuff
end

2.Write function named "splash" that shows splash screen in infinity loop, for example:
function splash()
  while(true) do
	print("sweet splash");
    sleep(1);
	shell.run("clear");
  end
end
3.To run splash screen, call
parallel.waitForAny(job, splash);

Well done!

//Sorry for my english, i'm only 12 years old, and i'm from poland.


Wersja Polska/Polish version:

Siemka, to mój pierwszy post. Pokażę ci jak zrobić ekran powitalny/ładowania dla twojego programu.

1.Napisz funkcję nazwaną "job" która ładuje ustawienia i tym podobne. (upewnij się, że funkcja nie pokazuje nic na ekranie!)
function job()
  --ładowanie itd.
end

2.Napisz funkcję nazwaną "splash" która pokazuje ekran w nieskończoność:
function splash()
  while(true) do
	print("super ekran powitalny");
    sleep(1); --żeby nie crashowało
	shell.run("clear");
  end
end
3.Aby odpalić ekran wywołaj:
parallel.waitForAny(job, splash);

Well done!

#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 13 August 2012 - 04:50 PM

For being 12 and Polish, your english is great!

#3 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 13 August 2012 - 06:11 PM

Your'e right! His english is good!

#4 ElvishJerricco

  • Members
  • 803 posts

Posted 01 September 2012 - 05:59 PM

I don't understand why you have to run them in parallel. Why not just make sure the job doesn't do any print(), print the splash and be done with it?

#5 IceCream

  • New Members
  • 28 posts

Posted 03 September 2012 - 04:10 AM

Nice English buddy :D/>


Could you tell me what your username means? Is it your name?

#6 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 03 September 2012 - 06:25 AM

So.. What is the point for this? Have something on the main while loading stuff?
Why not just
print("Splash")
-- internal code here that doesn't print anything
Nice English :D/>

#7 Sariaz

  • Members
  • 107 posts

Posted 23 September 2012 - 07:27 AM

 Noodle, on 03 September 2012 - 06:25 AM, said:

So.. What is the point for this? Have something on the main while loading stuff?
Why not just
print("Splash")
-- internal code here that doesn't print anything
Nice English :P/>

i think the reason is because if u have a more advanced splash screen like if u have a carector bounce around the screen instead of just printing something his/her way would work were your idea wouldn't. If ur just doing a splash text though your way would be better.

#8 Sariaz

  • Members
  • 107 posts

Posted 14 April 2013 - 07:08 PM

Now looking back at this after some more coding experience I think the point of running in parallel is so that you can have a while loop running the splash which if is animation would be hard to integrate with loading process as I said before. What I realize now is because its wait for any as soon as the jobs function finishes its work and loads that function will finish automatically ending the splash function.

#9 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 14 April 2013 - 07:35 PM

You could also do this
function job()
      --do stuff
end
function splash()
     print("A wonderful splash screen")
end
parrallel.waitForAll(job, splash)
term.clear()
term.setCursorPos(1,1)
Less flickering and no sleep needed and no loop

#10 TariqCrazymanTc0

  • Members
  • 9 posts

Posted 22 April 2013 - 01:12 AM

Cool A Polish Person That Haz Good English Thumbs Up For This Topic Its Really Good Due To It Having Multiple Languages

#11 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 22 April 2013 - 09:12 AM

I don't recall Lua needing ; after a line of code, or having to have a while true loop do while (true) do.... But nice English.

#12 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 22 April 2013 - 10:16 AM

The semicolon terminating the line is unnecessary, but I don't believe it has any detrimental effects.

#13 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 22 April 2013 - 12:08 PM

 Spongy141, on 22 April 2013 - 09:12 AM, said:

or having to have a while true loop do while (true)
It's a preference.

local function foo(num1,num2)
  return (num1) > (num2)
end
print(foo(tonumber( read() ), tonumber( read() )))

num1 and num2 do not need quotation. It is purely a preference.

#14 Spongy141

  • Members
  • 526 posts
  • Location'Merica

Posted 22 April 2013 - 01:20 PM

 SuicidalSTDz, on 22 April 2013 - 12:08 PM, said:

 Spongy141, on 22 April 2013 - 09:12 AM, said:

or having to have a while true loop do while (true)
It's a preference.

local function foo(num1,num2)
  return (num1) > (num2)
end
print(foo(tonumber( read() ), tonumber( read() )))

num1 and num2 do not need quotation. It is purely a preference.
Its kinda needed, since it would be very difficult to tell whats what without the (), but still a while true do loop doesn't necessarily need it.

#15 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 08:13 PM

 SuicidalSTDz, on 22 April 2013 - 12:08 PM, said:

num1 and num2 do not need quotation. It is purely a preference.
They are parantheses, bot quotations.^^

And you would need them if you'd want to change processing priorities of an expression, like:
local var1 = true
local var2 = false
local var3 = false

local result1 = (var1 or var2) and var3   -- Returns false
local result2 = var1 or var2 and var3   -- Returs true


#16 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 23 April 2013 - 01:20 AM

 Espen, on 22 April 2013 - 08:13 PM, said:

 SuicidalSTDz, on 22 April 2013 - 12:08 PM, said:

num1 and num2 do not need quotation. It is purely a preference.
They are parantheses, bot quotations.^^

And you would need them if you'd want to change processing priorities of an expression, like:
local var1 = true
local var2 = false
local var3 = false

local result1 = (var1 or var2) and var3   -- Returns false
local result2 = var1 or var2 and var3   -- Returs true
I don't know why I said quotation <_< and yes, in that case they are needed.

#17 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 21 October 2013 - 09:27 PM

 ElvishJerricco, on 01 September 2012 - 05:59 PM, said:

I don't understand why you have to run them in parallel. Why not just make sure the job doesn't do any print(), print the splash and be done with it?
You might have a splash screen that says "Loading...", and if you used his way it would actually be loading things.

#18 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 22 October 2013 - 01:31 AM

Aaand locked. You posted on a topic that's been dead for six months to reply to a post that's over a year old? Sigh. Please try to at least add something to the topic, since even your counterexample doesn't require parallel.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users