mIRC Home    About    Download    Register    News    Help

Print Thread
#111251 14/02/05 01:23 PM
G
Gremel
Gremel
G
This is the current working script:
Code:
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:
Code:
 /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.

#111252 14/02/05 01:47 PM
I
Iori
Iori
I
Code:
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 smile

#111253 14/02/05 03:06 PM
G
Gremel
Gremel
G
Oh, that slap2 bit is because when I first was working on it, the alias was called /slap2 I'll fix now smile

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?

#111254 14/02/05 03:20 PM
I
Iori
Iori
I
I didn't change the "/slap2" wink

/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
Code:
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 :)
  }
}

#111255 14/02/05 03:27 PM
G
Gremel
Gremel
G
Hmm...it doesn't seem to post the slaping bit when it comes up 'm'

I did a few random slaps and got this:

Quote:
* 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.

#111256 14/02/05 03:36 PM
G
Gremel
Gremel
G
I think I figured it out:

Code:
 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))
  }
} 

#111257 14/02/05 03:41 PM
I
Iori
Iori
I
Yeah I thought you meant to do /ta... in place of the normal action.

#111258 14/02/05 03:56 PM
G
Gremel
Gremel
G
Yeah, my mis information, though thanks for the help laugh

I am going to have fun with this I know it smile

#111259 14/02/05 04:00 PM
G
Gremel
Gremel
G
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.

Code:
 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))
  }
} 

#111260 14/02/05 04:18 PM
I
Iori
Iori
I
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"
Code:
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.

#111261 14/02/05 04:37 PM
G
Gremel
Gremel
G
Could you explain this $chr(124) bit? Where did you get 124 from?

#111262 14/02/05 04:40 PM
I
Iori
Iori
I
I did explain it laugh
$chr(124) (a | char) to it

//echo -a char $asc(|) = $chr(124)

#111263 14/02/05 04:46 PM
G
Gremel
Gremel
G
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!!!!

#111264 14/02/05 04:52 PM
G
Gremel
Gremel
G
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?

#111265 14/02/05 05:05 PM
Joined: Nov 2003
Posts: 2,321
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,321
Quote:
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.

Code:
//echo -a $asc(|) is the ascii number for |

#111266 14/02/05 05:12 PM
Z
ztnaraM
ztnaraM
Z
getchar echo -a $1 == $iif($1 isnum,$chr($1),$asc($1))

#111267 14/02/05 05:13 PM
G
Gremel
Gremel
G
Thanks smile


Link Copied to Clipboard