Arrays and killer detect :)

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Arrays and killer detect :)

Post 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
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

It may be possible to do so, but you need lots of if { }.....wow! Tough.......
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post 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........
Live to map, not map to live.
-mohaa_rox, .map
moderator
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

The detecting thingy.
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 ;).
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

WOW!!!

Post 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?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Code: Select all

local.array = "hello"::"world"
println local.array[1] " - " local.array[2]
Prints 'hello - world'.
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Whoops...

Post 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:
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply