mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
on dclick event,


Code:

 if ( $did == 103 ) { 
      did -h AutoList 103     
      msg %uno.channel Play $did($dname,103)




will msg the channel

Play C:\mIRC\images\B5.jpg "Or some other .jpg depending on the filename"

i want to strip this to have it msg only "Play B5" or "Play B 5" would be better.

Is there a way to do this?

Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
This is the final stumbling block for this addon.

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Try msg %uno.channel Play $left($nopath($did($dname,103)),-4)

or

msg %uno.channel Play $remove($nopath($did($dname,103)),.jpg)

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
.jpeg would break both of those.

I'd use $deltok($nopath($did(103)),-1,46)

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

True, that's why I added the second one, so he could add extensions...

msg %uno.channel Play $remove($nopath($did($dname,103)),.jpg,.jpeg,.gif,.bmp)

$deltok didn't come to mind, don't know why.

Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
wow thanx for the help. That was fast! let me try it out in a minute

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Use hixxy's

Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
ok... it works fantastic!!! now that you know what i am trying to do. the last thing i desperatly need to learn to do is, break up that filename.

i.e.

"B5" = "B 5"
"BDT" = "B DT"

this assumes that all of the filenames are .jpg and are like the examples. So how do i seperate the "B" from the rest of the filename?

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
it depends what "B"... "is"...

if B can be a string of any length then its more or less impossible to split it up unless you have some sort of rule as to how to do that...

if B is always one character:

$left($nopath($did($dname,103)),1)

The rest would be gotten using $mid. I suggest looking up the help for $left, $mid and $right.



- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
thanx, i was looking at that at the same time. i will try and solve it. Thank you again. smile

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Personally, I'd consider changing something so that your files and your output are the same rather than having to jump through hoops. smile

Still... here you are:

Code:
  var %card = $deltok(cardfilename.jpg,-1,46)
  var %card = $left(%card,1) $right(%card,-1)


Of course, you *can* put that on one line, but it means "running" the $deltok twice, which is a waste. If you want it on one line, replace both instances of %card in line two with what %card equals in line 1.


Invision Support
#Invision on irc.irchighway.net
Joined: Apr 2008
Posts: 51
K
kkoser Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Apr 2008
Posts: 51
ok thank you to everybody that helped me figure it out. i used this for the final. If you think i can do it better, let me know.

Code:

 if ( $did == 103 ) { 
      did -h AutoList 103 
      var %card3 = $deltok($nopath($did($dname,103)),-1,46) 
      var %card3 = $left(%card3,1) $right(%card3,-1) 
      if %card3 = W D4 {
        msg %uno.channel Play WD4
        halt
      }
      if %card3 = W ILD {
        msg %uno.channel Play WILD
        halt
      }
      msg %uno.channel Play %card3 
    }




Riamus2 it was a bit neccessary to jump through this hoop. the rest of the addon seems pretty stable. Thanx again to you and the rest for teaching me a bit about $left $mid and $right. smile

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

I would just get rid of the halts and use elseif and else...

Code:

if ( $did == 103 ) { 
      did -h AutoList 103 
      var %card3 = $deltok($nopath($did($dname,103)),-1,46) 
      var %card3 = $left(%card3,1) $right(%card3,-1) 
      if (%card3 = W D4) {
        msg %uno.channel Play WD4
      }
      elseif (%card3 = W ILD) {
        msg %uno.channel Play WILD
      }
      else {
        msg %uno.channel Play %card3
      }
    }


or

Code:

if ( $did == 103 ) { 
      did -h AutoList 103 
      var %card3 = $deltok($nopath($did($dname,103)),-1,46) 
      var %card3 = $left(%card3,1) $right(%card3,-1)
      if ((%card3 == W D4) || (%card3 == W ILD)) msg %uno.channel Play $remove($v1,$chr(32))
      else msg %uno.channel Play %card3
    }



Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Slight improvement (sorry, I forgot about wilds):

Code:
 if ( $did == 103 ) { 
      did -h AutoList 103 
      var %card3 = $deltok($nopath($did($dname,103)),-1,46) 
      if ($left(%card3,1) != W) { var %card3 = $left(%card3,1) $right(%card3,-1) }
      msg %uno.channel Play %card3 
    }


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard