Jump to content
Sign in to follow this  
ablueslime

Basic hint script not working

Recommended Posts

Hello, I've been following Fockers guide to scripting in Arma 3, and I've ran into trouble with the very first script, which just displays a hit. Here's what I have, it consists of 2 files:

(the files name is: init.sqf)

execVm "hint.sqf";

(the 2nd files name is: hint.sqf)

_me = player;

hint format ["player controlled is called: %1",_me];

Images:

4mhnm.png

4mhpV.png

4mhsv.png

The guide I'm following: www.armaholic.com/page.php?id=20465

Thank you for any help you can give me.

Share this post


Link to post
Share on other sites

What does 'not working' mean exactly? Is there an error? Nothing happens?

I have replicated exactly what you describe exactly, and it works fine.

You could try coping and pasting the contents of 'hint.sqf' into the debug console and executing it. You also do not need the waitUntil loop, and you could just use 'player' in the hint instead of defining '_me'.

You could try defining and calling the function directly in the init like so:

HintFunction = {
   hint format ["player: %1", player];
};
0 = [] call HintFunction;

Share this post


Link to post
Share on other sites

Thanks for the reply! A friend of mine actually figured out my issues (by not working i meant it wasn't even running) what happened was I didn't know you had to resave the entire mission in the editor after altering files. Thank you for help though, I appreciate the reply.

Share this post


Link to post
Share on other sites

You don't, only for things like init.sqf which run once at game start. That would just require you to restart the mission. If it was a script you were calling from a trigger for example you could edit it and try it again on the fly. description.ext however does need the full mission saved and restarted before changes appear.

Share this post


Link to post
Share on other sites

Hello, I would like to lean som ARMA scripting, so I startede reading Fockers guide to scripting in Arma 3.

But I have the same problem like ablueslime. No hint shows up on my screen. Its like init.sqf is not executing hint.sqf.

My files look like this:

init.sqf

execVm "hint.sqf";

hint.sqf

_me = player;
hint format ["player controlled is called: %1",_me];

I have tried doing like Zenophon suggested:

It works when I type the hint.sqf text in to the debug consol.

_me = player;
hint format ["player controlled is called: %1",_me];

When I type

HintFunction = { 
   hint format ["player: %1", player]; 
}; 
0 = [] call HintFunction;

in the init.sqf, this works.

I hope somebody have a good idea, this is making me crazy.

Share this post


Link to post
Share on other sites

It is very late here so I may not be thinking straight but:

1. execVm should be execVM -- DISREGARD - apparently not case sensitive

2. -deleted as bad advice-

3. Is your hint.sqf saved in your root directory with your init.sqf?

edit - updated based on below post, removed bad info

Edited by Zodd

Share this post


Link to post
Share on other sites
It is very late here so I may not be thinking straight but:

1. execVm should be execVM

2. Try calling it as [] execVM

3. Is your hint.sqf saved in your root directory with your init.sqf?

1. SQF is not case sensitive.

2. If you are not sending any arguments to the script, it's better to do null = execVM than [] execVM.

Share this post


Link to post
Share on other sites

Now I have tried with both null = execVM and [] execVM.

I have tried ind the init.sqf and in the debug console, but no luck. hmm :(

---------- Post added at 18:59 ---------- Previous post was at 18:17 ----------

Thank you for trying to help me.

At the moment it is working, I actually dont know what did it.

I tryed running ARMA 3 as Adminstrator, after that it worked. But it also workes when I start ARMA 3 from Steam. So Im confused. And a little bit happy. :)

Share this post


Link to post
Share on other sites

Did you copy the code from the text? if so itll be the "" they are in a different font/format and show up differently in sqf code

Share this post


Link to post
Share on other sites

@Decoy and ablueslime

Just to test, try putting a sleep 0.25; right before the "execVm "hint.sqf"; (Also try null = execVM "hint.sqf";)

Depending on how quickly the mission loads, the hint may be broadcasted before the player is ready to recieve it. The sleep 0.25; forces the script to wait for the game to completely start. If that works a waituntil {player==player}; may be of use.

Share this post


Link to post
Share on other sites
Did you copy the code from the text? if so itll be the "" they are in a different font/format and show up differently in sqf code

Jep, I was lazy, it was the "" that did the mess. Thank you, now the welcome message works too.

Thank you for your work with the script guide. Im looking forward to lean som scripting.

---------- Post added at 20:08 ---------- Previous post was at 19:59 ----------

@Decoy and ablueslime

Just to test, try putting a sleep 0.25; right before the "execVm "hint.sqf"; (Also try null = execVM "hint.sqf";)

Depending on how quickly the mission loads, the hint may be broadcasted before the player is ready to recieve it. The sleep 0.25; forces the script to wait for the game to completely start. If that works a waituntil {player==player}; may be of use.

The sleep 0,25 was not necessary for me.

Edited by Decoy

Share this post


Link to post
Share on other sites

Hi Everyone I am trying this script tutorial but i am getting error invalid number in expression. 

 

When i run it in debug i get :any instead of the players name.

 

could anyone help?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×