Home   Help Search Login Register  

Author Topic: remove added actions  (Read 910 times)

0 Members and 1 Guest are viewing this topic.

The_Milky_Bar_Kid

  • Guest
remove added actions
« on: 22 Dec 2002, 23:40:03 »
Okay, I have made a script which is activated through the action menu using the addAction command, now I was wondering how I remove the action from the menu, can anyone help?

Offline uiox

  • Contributing Member
  • **
Re:remove added actions
« Reply #1 on: 23 Dec 2002, 00:29:27 »
Not stupid look at editors depot...

joyeux Noel

Sorry

Merry Christmas

Offline Blanco

  • Former Staff
  • ****
Re:remove added actions
« Reply #2 on: 23 Dec 2002, 04:45:35 »
unitname removeaction ID

ID = is the same as you used in
ID = Unit addaction ["blablabla","nameofscript.sqs"]

Something like that ...I'm learning the same command at this moment...



 
Search or search or search before you ask.

Offline uiox

  • Contributing Member
  • **
Re:remove added actions
« Reply #3 on: 23 Dec 2002, 18:42:41 »
Sorry I've try to search something relates to add and remove action in editor's depot and nothing.

Now if you search you find.

It's a tutorial mission with titletext.
In it :

Add and remove actions with trigger
Add and remove actions with scripts
How to create a on/off action
Params return by the script
Some comon bugs
How to solve the problem of vehicle
An introduction to advanced addaction scripts

Offline Ruprt

  • Members
  • *
    • Ruprtova poradna k OFP
Re:remove added actions
« Reply #4 on: 23 Dec 2002, 19:15:47 »
unitname removeaction ID

ID = is the same as you used in
ID = Unit addaction ["blablabla","nameofscript.sqs"]
 

That's right.
First added action using AddAction has ID = 0, second has ID = 1 etc.
Each AddAction returns a number which means ID of added action.
Therefor use appropriate ID with removeAction command to remove desired action from menu.

The_Milky_Bar_Kid

  • Guest
Re:remove added actions
« Reply #5 on: 24 Dec 2002, 23:38:37 »
Thanks guys, I'll give that a go.

Chomps

  • Guest
Re:remove added actions
« Reply #6 on: 25 Dec 2002, 17:51:46 »
unitname removeaction ID

ID = is the same as you used in
ID = Unit addaction ["blablabla","nameofscript.sqs"]

Something like that ...I'm learning the same command at this moment...

That is the way it is supposed to work.  In the command reference BIS says the addAction command does not return an action ID, so you have to go with what Ruprt said.

The first custom action you add to an object is action 0.  If you remove action 0, that action will go away, no problem.  However, if you then add the same action, it now becomes action 1, so removing action 0 does nothing, you have to increment it the action ID you are removing.

It gets rather confusing, so I usually find a silly way to get around it, like keeping the action permenantly on the menu, but that is bad style.  If you can work out a functional algorithm to remove your actions correctly, that would be best.

Chomps

  • Guest
Re:remove added actions
« Reply #7 on: 25 Dec 2002, 17:52:45 »
By the way, I am also pretty new to this, so if any of that was wrong, feel free to pick it apart.

The_Milky_Bar_Kid

  • Guest
Re:remove added actions
« Reply #8 on: 25 Dec 2002, 22:02:56 »
It's all working now, I looked at Blanco's post, didn't really understand it, but ended up making my script have:

_action1 = unit addAction ["action1","action1.sqs"]

and later on

unit removeAction _action1

That worked fine, now can somone please tell me how I use scripts in my addons?