Home   Help Search Login Register  

Author Topic: addAction?  (Read 756 times)

0 Members and 1 Guest are viewing this topic.

redgun

  • Guest
addAction?
« on: 09 Jan 2005, 17:20:27 »
hi!

I'm working on a script, but my OFP-scripting skills are not very high so I need some help.

basically I want to add an action, which indicates me how much time is left, similar to the "set timer +30 sec" action.

i tried this:

zeit = ["Time left: %1",tleft]
a1 = player addAction [zeit,"tl1.sqs"]

"tleft" is the value that shows how much time is left
"tl1.sqs" is the script i want to be executed when activated.

When I try to execute it, the errorbox "type arraw, expected string" shows up.

Can anybody please help me?

THX, redgun
« Last Edit: 09 Jan 2005, 17:20:53 by redgun »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:addAction?
« Reply #1 on: 09 Jan 2005, 17:25:13 »
That's cause it's supposed to be a string, not an array. Try it like this:

zeit = "Time left: %1"
a1 = player addAction [zeit,"tl1.sqs"]

:beat: *Gets Shot* :beat:

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:addAction?
« Reply #2 on: 09 Jan 2005, 17:26:15 »
you can't give arguments to addaction.
what you need to do is in your script:
hint format ["Time left: %1",tleft]

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:addAction?
« Reply #3 on: 09 Jan 2005, 17:27:09 »
what are you talking about dmakatra?
that won't work at all...

redgun

  • Guest
Re:addAction?
« Reply #4 on: 09 Jan 2005, 17:28:17 »
Won't work? shit?

but I wonder how it is done with the "Set Timer +30 sec" action.

that action would look like that:

Set Timer +30 sec (29sec remaining)

i used "hint format" before, but somehow that silly noise every second made me nervous  ;D
« Last Edit: 09 Jan 2005, 17:32:27 by redgun »

redgun

  • Guest
Re:addAction?
« Reply #5 on: 09 Jan 2005, 17:59:32 »
i tried it and it doesn't work properly.

is there any way to switch of the nasty sound included in hints?

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:addAction?
« Reply #6 on: 09 Jan 2005, 18:10:00 »
what are you talking about dmakatra?
that won't work at all...

Hmmm... Will it work with format then?

:beat: *Gets Shot* :beat:

bored_onion

  • Guest
Re:addAction?
« Reply #7 on: 09 Jan 2005, 18:37:31 »
yeah itll only work with format.

in response try:

Code: [Select]
a1 = player addAction [format ["%1",zeit],"tl1.sqs"]
thats pure conjecture but it could work :P




Offline KTottE

  • Former Staff
  • ****
Re:addAction?
« Reply #8 on: 09 Jan 2005, 19:06:46 »
The action on the satchel charge is done in the config, and is not a normal user action.

I haven't tried using format for a user action but with all likelyhood it will not work since the action is added once and is not continously updated.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

bored_onion

  • Guest
Re:addAction?
« Reply #9 on: 09 Jan 2005, 19:17:05 »
you could always add loads of new actions in a script like this:

Code: [Select]
a1 = player addaction ["Time Left: 30","t11.sqs"]
~1
player removeaction a1
a2 = player addaction ["Time Left: 29","t11.sqs"]
;etc

depends how much time you want to measure and your will to live.

redgun

  • Guest
Re:addAction?
« Reply #10 on: 10 Jan 2005, 13:34:50 »
Thanks a lot guys!!  ;)

I gonna try "format", at least it would save me form some extra work.

if it doesn' work i'll have to use the solution suggested by bored_onion.

THX again
redgun

redgun

  • Guest
Re:addAction?
« Reply #11 on: 10 Jan 2005, 14:40:41 »
guess what!!

format worked, I can't believe it.
there just a few last changes I've to do before release.

I think you can look forward to it, even if it isn't the reinvention of the wheel.  ;D

THX to everybody, especially bored_onion.

redgun