mIRC Home    About    Download    Register    News    Help

Print Thread
Simple icon Question? dunno. #198590 01/05/08 09:44 PM
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?

Re: Simple icon Question? dunno. [Re: kkoser] #198591 01/05/08 09:45 PM
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.

Re: Simple icon Question? dunno. [Re: kkoser] #198592 01/05/08 10:00 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010

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

or

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

Re: Simple icon Question? dunno. [Re: RoCk] #198594 01/05/08 10:15 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
.jpeg would break both of those.

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

Re: Simple icon Question? dunno. [Re: hixxy] #198595 01/05/08 10:23 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010

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.

Re: Simple icon Question? dunno. [Re: RoCk] #198598 01/05/08 11:34 PM
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

Re: Simple icon Question? dunno. [Re: kkoser] #198599 01/05/08 11:57 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010

Use hixxy's

Re: Simple icon Question? dunno. [Re: RoCk] #198600 02/05/08 12:01 AM
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?

Re: Simple icon Question? dunno. [Re: kkoser] #198601 02/05/08 12:21 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
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"
Re: Simple icon Question? dunno. [Re: argv0] #198602 02/05/08 12:54 AM
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

Re: Simple icon Question? dunno. [Re: kkoser] #198609 02/05/08 01:52 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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
Re: Simple icon Question? dunno. [Re: Riamus2] #198629 02/05/08 10:38 AM
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

Re: Simple icon Question? dunno. [Re: kkoser] #198634 02/05/08 12:57 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010

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
    }



Re: Simple icon Question? dunno. [Re: kkoser] #198647 02/05/08 03:27 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
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