Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Addaction error but it works.

  1. #1

    Addaction error but it works.

    I'm currently using some script to move me around game logics, triggers and units instantly.

    It work perfectly except it keeps producing the same error, it's just annoying to have to wade through that error to look for others. I know where the error is and what causes it I just don't know a neat way of doing what I'm doing.

    Code:
    for [{_i=0},{_i < count _port},{_i = _i+1}] do
    {
    	_temp = _port select _i;
    	_unit addAction ["move to "+str _temp,"moveto.sqf",_temp,1,false,true,""];
    };
    The error is producing part is
    Code:
    "move to "+str _temp
    and the error says something like "Wrong text element 'no'". The code is fine and it displays the exactly how I want it "moveto gamelogicname".

    I'd just like it without the error or having to code every action, I don't want it on the radio either.

    It's mostly for testing missions so isn't the biggest problem in the world but it would be nice to fix it.

  2. #2
    Why not use:
    Code:
    format ["move to %1",_temp]
    VBS2 Designer

    Quote Originally Posted by Armored_Sheep View Post
    I like to call Arma a sandbox game that works pretty much like LEGO - you buy it not just because you want to have a nice car from the main picture on its box, do you?

  3. #3
    Warrant Officer
    Join Date
    Jun 2 2009
    Location
    UK
    Posts
    2,782
    Author of the Thread
    Thanks but it gives the same error, I believe anything other than text contained between quotes triggers the error. It doesn't seem to allow any form of variable.
    Last edited by F2k Sel; Aug 6 2009 at 15:11.

  4. #4
    I use formatted strings all the time, they should work anywhere a regular string would work. I'm not quite sure what that error means, but have you tried checking the value of the elements of '_port'? What exactly does it contain? Maybe it's a bad data type or something.

  5. #5
    If _temp is a variable passed to the action, its wrong.
    Addaction takes an array... Make it [_temp] instead. In the action file you just grab the arguments with _args = this select 3 and do _temp = _args select 0.

    Edit: oh I just read that might not be the problem. Well if it works it works
    Last edited by Murklor; Aug 6 2009 at 15:37.

  6. #6
    Warrant Officer
    Join Date
    Jun 2 2009
    Location
    UK
    Posts
    2,782
    Author of the Thread
    Cheers guys I did find a fix that gives no errors.

    Code:
    for [{_i=0},{_i < count _port},{_i = _i+1}] do
    {
        _temp = _port select _i;
    	temp="Move To "+str _temp;
    		_unit addAction [temp,"MoveTo.sqf",_temp,1,false,true,""];
    };
    It only seems to work with a global variable, I think that's what it's called.

  7. #7
    That's odd. It really should work either way.

  8. #8
    Warrant Officer
    Join Date
    Jun 2 2009
    Location
    UK
    Posts
    2,782
    Author of the Thread
    I'm sure I tried that yesterday but still got the error, I must have forgot to clear the rpt file.

    The odd part is that it worked perfectly even with the error but I was worried that it might cause unknown problems later.

  9. #9
    Indeed the .rpt can be misleading. Have you used -showScriptErrors? Should give you more instant feedback.

  10. #10
    Warrant Officer
    Join Date
    Jun 2 2009
    Location
    UK
    Posts
    2,782
    Author of the Thread
    It looks like part of the problems was that I was passing a trigger name.

    That was what was causing the wrong element error and still happens when using a global variable. You did mention this in an earlier post Dawg and I thought I'd removed all entries for triggers but one slipped through.

    Also using format does now work as it should.

    However you can't use local variable on it's own, that will just cause an error preventing the line form executing.


    Dawg where would I place -showScriptErrors, it says command line but where is that?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •