|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
This is the current working script: alias testslap {
if $chan == #Santharia {
if !$chan { echo -ac info * /slap2: must be on a channel }
else {
if !$hget(slap) { hmake slap | hload slap slap.hsh }
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,m))
}
else {
if !$chan { echo -ac info * /slap2: must be on a channel }
else {
if !$hget(slap) { hmake slap | hload slap slap.hsh }
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
}
}
}
} What i want to do is this: If the $rand(a,m) part comes up 'm' then do the following commands: /ta approaches $1 with evil intent. Also, I am not sure if the above is right. I want the $1 in it to be the same as the $1 in the slap script above. Any suggestions? Hopefully you wont need to change the script too much.
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
alias testslap {
if !$chan { echo -ac info * /slap2: must be on a channel }
if !$hget(slap) { hmake slap | hload slap slap.hsh }
if $chan == #Santharia {
var %a = $rand(a,m)
if %a == m { ta approaches $1 with evil intent }
else describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$v1)
}
else {
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
}
} I didn't change it but /slap2 isn't the name of this alias
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Oh, that slap2 bit is because when I first was working on it, the alias was called /slap2 I'll fix now And you said you didn't change it, but it looks like you changed some of the stuff. Could you explain what ya did? I know about the varible bit, but what purpose does the $v1 have? Is this something that says put the result of $a here?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
I didn't change the "/slap2" /help $v1 - $v1 & $v2
Returns the first and second parameters of an if-then-else comparison.
In this case I compared "if %a == m " so $v1 is %a and $v2 is m alias testslap {
if !$chan { echo -ac info * /slap2: must be on a channel }
; ^ moved this and removed duplicate
if !$hget(slap) { hmake slap | hload slap slap.hsh }
; ^ moved this and removed duplicate
if $chan == #Santharia {
var %a = $rand(a,m)
: obtain result of $rand to check if it is "m"
if %a = m { ta approaches $1 with evil intent }
; If it is "m" it calls the ta alias as you requested
else describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$v1)
; if it is not it describes as before
}
else {
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
; unchanged except for removal of duplicate/redundant code :)
}
}
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Hmm...it doesn't seem to post the slaping bit when it comes up 'm' I did a few random slaps and got this: * Gararion whacks test with a Volvo... that was clamped anyway so the driver doesn't mind. * Gararion strikes test with a shovel plucked right from a pile of chicken [censored]. -> *Tasha* act #Santharia approaches test with evil intent * Tasha approaches test with evil intent Before that *Tasha approaches... bit, it was suppose to do the random slap that is under 'm' in my has table.
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
I think I figured it out: alias slap {
if !$chan { echo -ac info * /slap: must be on a channel }
if !$hget(slap) { hmake slap | hload slap slap.hsh }
if $chan == #Santharia {
var %a = $rand(a,n)
if %a = n {
describe # $hget(slap,$v1) $1 $+ .
ta approaches $1 with evil intent
}
else describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$v1)
}
else {
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
}
}
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Yeah I thought you meant to do /ta... in place of the normal action.
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Yeah, my mis information, though thanks for the help I am going to have fun with this I know it
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Tried adding a cvalentines twist to one of them, but the timer doesn't seem to be working, could you be kind and help me out once more? Or if anyone else sees the error i would be glad to hear it. alias slap {
if !$chan { echo -ac info * /slap: must be on a channel }
if !$hget(slap) { hmake slap | hload slap slap.hsh }
if $chan == #Santharia {
var %a = $rand(a,n)
if %a = n {
describe # $hget(slap,$v1) $1 $+ .
ta approaches $1 with evil intent
}
else %a = o {
describe # $hget(slap,$v1)
ta comes to life and stares at $1 $+ .
ts I....must....resist....programing....can't....RUN!!!!
ta eyes begin to glow red.
timer1 1 10 {
/ta jumps for $1 and wraps her metallic arms about their waist.
/ts I love you!
}
}
else describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$v1)
}
else {
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
}
}
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
You can't use { mulitple lines } in a timer like that in this case its easy enough to add a $chr(124) (a | char) to it. and "else %a == o" should be elseif %a == o" or you're settigng %a to "o"
alias slap {
if !$chan { echo -ac info * /slap: must be on a channel }
if !$hget(slap) { hmake slap | hload slap slap.hsh }
if $chan == #Santharia {
var %a = $rand(a,n)
if %a == n {
describe # $hget(slap,$v1) $1 $+ .
ta approaches $1 with evil intent
}
else[color:red]if[/color] %a == o {
describe # $hget(slap,$v1)
ta comes to life and stares at $1 $+ .
ts I....must....resist....programing....can't....RUN!!!!
ta eyes begin to glow red.
timer1 1 10 ta jumps for $1 and wraps her metallic arms about their waist. [color:blue]$chr(124)[/color] ts I love you!
}
else describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$v1)
}
else {
describe # $hget(slap, $rand(1,9)) $1 $hget(slap,$rand(a,l))
}
}
Should work, depends on how the /ta & /ts aliases are set up.
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Could you explain this $chr(124) bit? Where did you get 124 from?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
I did explain it $chr(124) (a | char) to it //echo -a char $asc(|) = $chr(124)
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Okay I typed //echo -a char $asc(|) = $chr(124) and all I got was: char 124 = |
Say if I wanted to add another line to that timed stuff. Let's say:
/ts Happy Valentine's Day!!!!
What would I do then? Would I add this to the end of that sentenance:
$chr(124) ts Happy Valentine's Day!!!!
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Okay, I think I got it now. $chr(124) produces |
I assume that if I just put this in the line it wouldn't work?
Also, how did you know that 124 stood for |? did you use the alt num-pad code or something?
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Also, how did you know that 124 stood for |? did you use the alt num-pad code or something? $asc() gives you the ascii number of a character. //echo -a $asc(|) is the ascii number for |
New username: hixxy
|
|
|
|
Joined: Jan 2005
Posts: 75
Babel fish
|
Babel fish
Joined: Jan 2005
Posts: 75 |
getchar echo -a $1 == $iif($1 isnum,$chr($1),$asc($1))
|
|
|
|
Joined: Mar 2004
Posts: 96
Babel fish
|
OP
Babel fish
Joined: Mar 2004
Posts: 96 |
Thanks
|
|
|
|
|