Home   Help Search Login Register  

Author Topic: Greeting message, local?  (Read 2055 times)

0 Members and 1 Guest are viewing this topic.

Offline Cougarxr7

  • Members
  • *
Greeting message, local?
« on: 07 Jul 2009, 13:12:55 »
I have a greeting message for the server in sqs format.. The problem is it runs for all everytime someone joins the the game.
I have tried this,
Code: [Select]
?!local _unitName : goto "start"
#start
_counter = 1;
#loop
~10
Of course it did not work.
What I'd like to happend is the joining player gets the message, not players that has been in the server already.
Thanks!
If this thread is in volation of forum rules , please delete.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Greeting message, local?
« Reply #1 on: 07 Jul 2009, 16:18:49 »
There is no message being shown in that code snippet (which also makes little sense out of context) and you haven't told us how you run it.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Cougarxr7

  • Members
  • *
Re: Greeting message, local?
« Reply #2 on: 07 Jul 2009, 16:48:22 »
My bad!
Here.
Code: [Select]
~10
titleText [format ["MESSAGE, %1", name player], "Plain down"]<this will be seen by all.
~10
?!local _unitName : goto "start"< from here on down joining player only.
#start
_counter = 1;
#loop
~10
titletext ["MESSAGE","Plain down"] 
~10
titletext ["MESSAGE!","Plain down"]
_counter = _counter - 1
? _counter > 0 : goto "loop"
exit
~10
If this thread is in volation of forum rules , please delete.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Greeting message, local?
« Reply #3 on: 07 Jul 2009, 20:10:12 »
I've decided I'm finally going to completely stop supporting SQS any more, because it has been obsolete for a very long time and is literally a dead end for anyone who uses it, actually preventing them from writing good scripts! Also answers on how to use it only helps people to stay in a backwards language that hinders their abilities (and doesn't help people who have made the leap to SQF). Thus, it is simply a waste of my time. Sorry!

Your code seems a bit confused compared to what you said you wanted to achieve, so I'm not sure what is going on (and I can't fix something that I don't understand the intention of). Also, you didn't say how you ran it, which was the important part of what I asked you. If you run it in init.sqf(/sqs) then it will only run once. If you run it from the init line of all playable object, which is what I suspect you are doing, then yes, it will run every time someone JIPs into an empty position (assuming disabledAI is on).
Code: (init.sqf) [Select]
// Must wait until there is a player object spawned in to get the name of.
if (not isDedicated) then { waitUntil { alive player }; };
// Show this message once when player initially joins the game.
titleText [format ["Hello, %1, you are about to become a moon-fairy!", name player], "Plain down"];

« Last Edit: 08 Jul 2009, 00:45:50 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Cougarxr7

  • Members
  • *
Re: Greeting message, local?
« Reply #4 on: 08 Jul 2009, 00:00:08 »
Spooner, thank you for the sqf file. I've been wanting to get rid of that sqs file.
Again Thanks!
If this thread is in volation of forum rules , please delete.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Greeting message, local?
« Reply #5 on: 08 Jul 2009, 00:47:27 »
Yes, sorry, the declamation against SQS wasn't personally directed at you, but it is something that I've meaning to do for a while  :whistle:

I forgot the isDedicated check so that you don't wait forever if run on a dedi server (edited previous post).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Cougarxr7

  • Members
  • *
Re: Greeting message, local?
« Reply #6 on: 08 Jul 2009, 01:39:39 »
Spooner, no need to ever apologize to me, we are human and to me that makes us a 24/7 walking apology.
Is the sqf limited to a one line message?
I tried this in the init.sqf and it only showed the first line.
Code: [Select]
if (not isDedicated) then { waitUntil { alive player }; };
titleText [format ["Hello, %1, you are about to become a moon-fairy!", name player], "Plain down"];
sleep5
titletext ["my message!","Plain down"] 
sleep5
titletext ["my message","Plain down"]
sleep5
titletext ["my message","Plain down"]
sleep5
Then I tried it as a "greetings.sqf, with [] execVM "greetings.sqf"; in the init.sqf.
Only the first line showed up.
??
If this thread is in volation of forum rules , please delete.

Offline Deadfast

  • Members
  • *
Re: Greeting message, local?
« Reply #7 on: 10 Jul 2009, 02:45:39 »
In SQF every line of command has to be ended by a semi column (;):

Code: [Select]
if (not isDedicated) then { waitUntil { alive player }; };
titleText [format ["Hello, %1, you are about to become a moon-fairy!", name player], "Plain down"];
sleep 5;
titletext ["my message!","Plain down"];
sleep 5;
titletext ["my message","Plain down"];
sleep 5;
titletext ["my message","Plain down"];
sleep 5;

Offline Cougarxr7

  • Members
  • *
Re: Greeting message, local?
« Reply #8 on: 10 Jul 2009, 16:17:39 »
Deadfast, I totally spaced out and can't believe I missed something so common as those ;!
Thanks!
« Last Edit: 11 Jul 2009, 17:00:44 by Cougarxr7 »
If this thread is in volation of forum rules , please delete.