Page 1 of 1

Arrays and killer detect :)

Posted: Thu Feb 20, 2003 11:56 am
by Rookie One.pl
Hi,

I've got a question. If I want to put strings with spaces into an array (i.e. string 1::string 2::string 3 etc.), do I have to put them in ""s? And the other thing. I was wondering, is it possible to detect who - player or an AI - killed an AI (the same thing twice - LOL :lol:)?

Thanks in advance,

Rookie One

Posted: Thu Feb 20, 2003 12:45 pm
by mohaa_rox
It may be possible to do so, but you need lots of if { }.....wow! Tough.......

Posted: Thu Feb 20, 2003 12:45 pm
by mohaa_rox
It may be possible to do so, but you need lots of if { }.....wow! Tough.......

If it's that easy, it would help jv with his bots........

Posted: Thu Feb 20, 2003 1:15 pm
by Rookie One.pl
mohaa_rox wrote:It may be possible to do so, but you need lots of if { }.....wow! Tough.......

If it's that easy, it would help jv with his bots........
Sorry, but I don't know what do you mean. What may be possible to do, detecting or the array?

Posted: Thu Feb 20, 2003 2:19 pm
by mohaa_rox
The detecting thingy.

Posted: Thu Feb 20, 2003 3:30 pm
by jv_map
You need quotation marks if you use elements of more than one word or need to use special signs. In general, use them always, they don't hurt.

Killer detection is actually very easy. After a bot's death, his value .fact.attacker is set to the attacking enemy. For example:

Code: Select all

$ai waittill death
iprintlnbold_noloc $ai " was killed by " $ai.fact.attacker
Virtually impossible to find out :?, but very easy once you have ;).

WOW!!!

Posted: Thu Feb 20, 2003 3:43 pm
by Rookie One.pl
And that's it???
But with the arrays, I don't understand how to use them... :oops: Can you give me an example, please?

Posted: Thu Feb 20, 2003 4:05 pm
by jv_map

Code: Select all

local.array = "hello"::"world"
println local.array[1] " - " local.array[2]
Prints 'hello - world'.

Whoops...

Posted: Fri Feb 21, 2003 4:57 pm
by Rookie One.pl
Ooops! :oops: I've read "quotation marks" as "question marks", that's why I said I don't understand :oops: Sorry :oops: