News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Custom Mission Scripting - The Basic's  (Read 7682 times)

0 Members and 1 Guest are viewing this topic.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #15 on: July 29, 2015, 10:57:07 AM »
Heh I already did that ages ago check my video's.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #16 on: July 29, 2015, 11:03:26 AM »
Both of you, stop the double posting.

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #17 on: July 29, 2015, 11:05:44 AM »
Even if they suck you can still release them, may be fun. Or what I usually do when a mod of mine isn't very good I still release it but just don't make a public topic for it.

Functions can return values like this:

Code: [Select]
function IsLostInSpaceCool()
  return false
end

Then doing this as a simple example:
if IsLostInSpaceCool() then
  TextPrintString("Yes",1,1)
else
  TextPrintString("No",1,1)
end
-- Would print "no" if run.

You can return any type of value you want from a function by simply using return followed by a value/expression.
Using return makes the function end too and return to the point in the script that the function was called.
« Last Edit: July 29, 2015, 11:16:27 AM by DaBOSS54320 »

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #18 on: July 29, 2015, 12:24:26 PM »
Thanks so I would run this in a thread or put this under the repeat line?

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #19 on: July 29, 2015, 12:25:43 PM »
The function should probably be declared in global scope (put the function outside of any other function)
and you can call it wherever you want to.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Custom Mission Scripting - The Basic's
« Reply #20 on: July 29, 2015, 12:27:53 PM »
Ah I understand now so use that as a variable so I can get it to turn when I need it excellent thanks for the help will add it to the post. I am actually planning on updating it right now.