Home   Help Search Login Register  

Author Topic: variables (tough)  (Read 3143 times)

0 Members and 1 Guest are viewing this topic.

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:variables (tough)
« Reply #15 on: 25 Jul 2003, 10:17:35 »
and what does it mean to execute a string as if it were code?  does that mean it just gets rid of the quotes?
Quote

Yep, it does get rid of the quotes.

Lets say you have this global variable...

mycodestring = "player setdamage 1"

If in  a script, you put..

Code: [Select]
call mycodestring

it would be EXACTLY the same as putting this in the script...

Code: [Select]
player setdamage 1

The call command simple takes a string and "executes" the contents of the string as if you had typed the string in the script.

"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:variables (tough)
« Reply #16 on: 25 Jul 2003, 10:18:18 »
nevermind, questions answered  :)

is my imagination or has format been around longer than call?  kind of weird considering call is just the opposite of format (in my understanding of it).

new problem:
i put this in a guy's init:
Quote
(call (soldiernames select 0) = this);

it says unknown operator and points at the =, what gives?
is call restricted to local variables or something?
« Last Edit: 25 Jul 2003, 10:31:55 by pablo_m123 »

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:variables (tough)
« Reply #17 on: 25 Jul 2003, 23:12:11 »
It's possible the call command will not work in a units init feild. Why not just name the soldier?


Format has been around since v1.0. It outputs a string as opposed to the call command which outputs the contents of a string.


Edit:call and format can be used together to create dynamically named variables, which has led to alot more posibilities for those nuts who code COC. I won't get into that though. I havn't had my Coffee yet this morning.

« Last Edit: 25 Jul 2003, 23:16:46 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:variables (tough)
« Reply #18 on: 26 Jul 2003, 00:16:41 »
Quote
It's possible the call command will not work in a units init feild. Why not just name the soldier?

there was a reason, i just don't remember it right now...

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:variables (tough)
« Reply #19 on: 26 Jul 2003, 00:26:02 »
@ pablo

u forgot 2 add da

::)

in da endof ur sentence ;)

so it shud b like dat

there was a reason, i just don't remember it right now...  ::)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.
Re:variables (tough)
« Reply #20 on: 26 Jul 2003, 00:36:37 »
oh no!  :o

lol

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:variables (tough)
« Reply #21 on: 26 Jul 2003, 01:02:56 »













LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta