|
Morpheus Newbie
Joined: 01 Feb 2002 Posts: 8 Location: Norway
|
Posted: Fri May 03, 2002 1:26 pm
Additem |
Hi,
Yes it's me again.
In my statusline (#ST) I display the variable @Line.
This variable contains, a few default values, Like how many kills I make.
I already have setup to count how many kills my team mates make. It would be convenient if I could manage to get this displayed in the status line as well. Been doing some head scratching on this and thought the best way to do this, would be to put all I wanted displayed in he statusline into (#ST) one variable “line”.
I thought it would be a good idea to use the additem command.
Ok.. this is what I have so far… The problem is only in the last line of the code, but I added the whole thing for you to get the picture.
Pattern (%w) joined your team.
#VAR %1 "" ""
#action {%1 killed} {#MATH %1 (@%1+1)} Teamkills
#additem Line {%1 @%1},
Comments.
1. Crate the variable, lets say Xar
2. Adds 1 to the variable Xar when Xar gets a kill
3. Here I want to add the variable @Xar to the variable "line". Preferably I would like to be displayed in the status line as: Xar kills,"the number of kills xar made". However it does now work.
I’ll need a way to remove it as well. I assume I can use delitem. Have not started to work on that yet though
Maybe I am going by this all wrong? Might be an easier way to do this?
Any help is greatly appreciated!
Morph |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri May 03, 2002 4:05 pm |
It might have helped if you had said how it doesn't work.
In #additem Line {%1 @%1} the variable, @%1, is evaluated immediately. To prevent this, use ~@%1.
#additem Line {%1 ~@%1}
LightBulb
Vague questions get vague answers |
|
|
|
Morpheus Newbie
Joined: 01 Feb 2002 Posts: 8 Location: Norway
|
Posted: Fri May 03, 2002 11:43 pm |
Right, Good point.
I will try to be more specific. I’ll also keep my example from above with Xar.
When the line look like this,
#additem Line {%1},
Xar is added to variable “line”. This is of course totally useless. I need to variable @%1 added as well. When I try to add the variable too, NOTHING at all is added to the variable “line”
Basically the problem seem to occur when I want to add a variable to a variable using #additem.
The suggested changes do not seem to do anything.
The result I want to end up with is the following added to the variable “line”
Xar @Xar
Morph |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat May 04, 2002 12:58 am |
Works fine for me. It's probably your #ACTION command, which needs the same modification for the same reason.
#action {%1 killed} {#MATH %1 (~@%1+1)} Teamkills
Of course, it would be easier to do this one with #ADD instead of #MATH which eliminates the problem of delayed evaluation.
#action {%1 killed} {#ADD %1 1} Teamkills
LightBulb
Vague questions get vague answers |
|
|
|
Morpheus Newbie
Joined: 01 Feb 2002 Posts: 8 Location: Norway
|
Posted: Sat May 04, 2002 7:47 am |
Hey! Now that was just excellent!!
It works!
*bounce*
Thanks LightBulb!
Morph |
|
|
|
|
|