|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
I hope this is the right place for it... var %i = 1 var %x = $$2 /person { if ( $$1 = minus) { var %i = %i - var %x }} //say person has lost: %x points. //say person now has: %1 points. { if ( $$1 = add) { var %1 = %i + var %x }} //say person has gained: %x points. //say person now has: %1 points. else { halt } That is my script I have right now, and whenever I run it... it quits me from mIRC Here's what I want it to do: I type " /person minus 2" it outputs: "Person has lost: 2 points" "Person now has: -1 points" or I put in "/person add 2" and it says: "Person has gained: 2 points" "Person now has: 3 points" can someone help me with my situation? Moved to Scripts & Popups
Last edited by Mentality; 19/12/04 11:00 PM.
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
er... I kinda fixed it... now, new question /person { { if ( $$1 = minus ) { var %i = %i - %x } //say person has lost: %x point. //say god now has: %i points. } { if ( $$1 = add ) { var %i = %i + %x } //say person has gained: %x point. //say person now has: %i points. } else { halt } } that's my script, and I defined the variables in the variable section :tongue: now, here's the problem: It won't keep track, like. First time, I add one, so it has 1 point second time, I add one, and it has 1 point, not two
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
here;s the question: How can I make a variable that doesn't reset it's calue after every time I use it?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Well, that's a fine mess LOL I assume that "Person" is a static name, and that this is going into Aliases. person {
[color:gray] ; if the score variable doesn't exist, create it
; I used %person as the scoring variable name, change every occurence of if as you wish[/color]
if !%person { set %person 0 }
[color:gray] ; set the var to add/minus $2 -- '$replace($1,minus,-,add,+)' changes "add" to "+" or "minus" to "-"
; thus the same line is used to increase or decrease the variable[/color]
set %person %person $replace($1,minus,-,add,+) $$2
[color:gray] ; '$replace($1,add,gained,minus,lost)' again changes $1, "add" becomes "gained" and "minus" becomes "lost"[/color]
say Person has $replace($1,add,gained,minus,lost) $2 points
say Person now has: %person points
} BTW you can also use "/person + 3", "/person - 2"
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
Well, that's a fine mess LOL I assume that "Person" is a static name, and that this is going into Aliases. person {
[color:gray] ; if the score variable doesn't exist, create it
; I used %person as the scoring variable name, change every occurence of if as you wish[/color]
if !%person { set %person 0 }
[color:gray] ; set the var to add/minus $2 -- '$replace($1,minus,-,add,+)' changes "add" to "+" or "minus" to "-"
; thus the same line is used to increase or decrease the variable[/color]
set %person %person $replace($1,minus,-,add,+) $$2
[color:gray] ; '$replace($1,add,gained,minus,lost)' again changes $1, "add" becomes "gained" and "minus" becomes "lost"[/color]
say Person has $replace($1,add,gained,minus,lost) $2 points
say Person now has: %person points
} BTW you can also use "/person + 3", "/person - 2" er...thanks ^^; I'l try it now.. and... problem now it's saying stuff like: Person now has: -2 gain 2 + 2 - 2 points what's wrong?
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
er...nvm ^^; Thanks a lot ^^
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Err yeah +|- works but I didn't consider those for say line. - say Person has $replace($1,+,gained,-,lost,add,gained,minus,lost) $2 points
|
|
|
|
Joined: Dec 2004
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Dec 2004
Posts: 18 |
Err yeah +|- works but I didn't consider those for say line. - say Person has $replace($1,+,gained,-,lost,add,gained,minus,lost) $2 points
........ Please tell me that doesn't work if so, I have wasted a lot of time for THAT
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
ROFL The final code without all the comments is person {
if !%person { set %person 0 }
set %person %person $replace($1,minus,-,add,+) $$2
say Person has $replace($1,+,gained,-,lost,add,gained,minus,lost) $2 points
say Person now has: %person points
} and yes it should work.
|
|
|
|
|