counter print question

Post your scripting questions / solutions here

Moderator: Moderators

7th Es Cyborg
First Lieutenant
Posts: 189
Joined: Fri Dec 13, 2002 5:00 pm
Location: PA
Contact:

counter print question

Post by 7th Es Cyborg »

ok I'm using a local.counter and need to print out the value ingame

how would that script be done with iprintlnbold "You died ( counter here ) times."

this is not the actual useage, but you can see what i need.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

i think u need to use some sort of convert string thing. like how the singleplayer maps tell you what key to press to go forward. (m1l1)
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

quotes in " and then what ever you like, repeat as necessary

e.g.

iprintlnbold_noloc "This counter is on " level.counter " so hurry your ass up " level.something_else

or

if ( level.die_counter == 1 )
{iprintlnbold_noloc "You died for the 1st time"}
if ( level.die_counter == 2 )
{iprintlnbold_noloc "You died for the 2nd time keep trying though"}
if ( level.die_counter == 3 )
{iprintlnbold_noloc "3rd time now, do you think your a target ???"}
if ( level.die_counter >> 3 )
{iprintlnbold_noloc "For the " level.die_counter "th time, will you STOP DYING!!!"}




for counters use level. rather than local.
hope this helps, prob not cos it's all foreign 2 me :-/
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Or just:

Code: Select all

iprintlnbold "You died " + local.counter + " times."
Admin .MAP Forums
Image
Head above heels.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

some people take all the fun out of scripting :P
hope this helps, prob not cos it's all foreign 2 me :-/
7th Es Cyborg
First Lieutenant
Posts: 189
Joined: Fri Dec 13, 2002 5:00 pm
Location: PA
Contact:

Post by 7th Es Cyborg »

danka
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

Some people over script a simple line too.


If you don't want all that clicking with "iprintlnbold_noloc", you can use just "iprintln". That makes it show up on the leftside of the screen in yellow and with no clicking sound.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Bjarne BZR wrote:Or just:
iprintlnbold "You died " + local.counter + " times."
Sorry but that won't work :P

Try this:
iprintlnbold ("You died " + local.counter + " times.")

The other one is not allowed since the syntaxis of the iprintln command is the following:
iprintlnbold [string1] [string2] [string3].....

Thus you can type
iprintlnbold "hello " "world"

but not
iprintlnbold "hello " + "world"

If you put it between parens however, it's automatically casted to a string and supplied as the first argument only, instead of multiple.
iprintlnbold ("hello " + "world")
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Trust jv to slap you on the fingers as soon as you post anything remotely similar to a script :wink:
Thanx jv :oops:
Admin .MAP Forums
Image
Head above heels.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Actually I like nuggets version better, except this is a classical time to use the switch statement:

Code: Select all

switch (level.die_counter)
{
  case 1: {
    iprintlnbold_noloc "You died for the 1st time"
    break
  }
  case 2: {
    iprintlnbold_noloc "You died for the 2nd time keep trying though"
    break
  }
  case 3: {
    iprintlnbold_noloc "3rd time now, do you think your a target ???"
    break
  }
  default: {
    iprintlnbold_noloc "For the " level.die_counter "th time, will you STOP DYING!!!"
  }
}
Jv? :wink:
Admin .MAP Forums
Image
Head above heels.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

although we love the switch statement, i though i'd just try to show an easy introduction to the language of scripting

i could of taken it a step further and used something even more complicateder but me no good at complicated schtuff :P
hope this helps, prob not cos it's all foreign 2 me :-/
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The compiler might not like the curlies around each case. :?
Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

they'll be happy, with the use of ; in there (line seperator)
hope this helps, prob not cos it's all foreign 2 me :-/
7th Es Cyborg
First Lieutenant
Posts: 189
Joined: Fri Dec 13, 2002 5:00 pm
Location: PA
Contact:

Post by 7th Es Cyborg »

thanks JV that fixed it up, what I'm doing in converting the mohaa maps into CTF maps using a script that tstrait72 and scorpio made with some modifications. Since the original is first capture wins the round, I changed it to you need 3 captures to win and when one team gets a cap. it shows the current score to the left.
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

thanks JV??? i mean thanks where thanks is due... but come on!!!
hope this helps, prob not cos it's all foreign 2 me :-/
Post Reply