FPM - File Playing Module -

By HeatedHeart on Aug 10, 2009

Well this is an expansion of my Text File System this one is ALOT more advanced. it now rocks a dialog, it also has more extensions that just .txt, this one also keeps track of all your triggers and not just one. For educational purpose's ill keep my old one up. in case people prefer simplicity over this. Anyways enjoy.

P.S: Vista users.. i warn you now. people have had some problems trying to use my scripts that use $findfile in them. i don't know why, nore do i know how to fix it. I use XP so i cant recreate the errors and try and solve them. Your welcome to try my snippet anyways, it wont cause a problem it just wont load the text files. My condolences, just do not rate my script because it doesnt work for you.

Double P.S: Yeah this one is sorta an update of my old snippet, but so much was changed that i felt it deserved a spot of its own. this one is completly and entirely different than my old Text file system, so please hawkee, do not move my thread.

Image

;;;;;;;;;;;;;;;;;;;;;;;
;;File Playing Module;;
;;By HeatedHeart-----;;
;;XeroChat3 Team-----;;
;;;;;;;;;;;;;;;;;;;;;;;
;#### Startup
on *:LOAD:{ 
  hmake FPM 50
}
on *:START:{ 
  hload FPM FPM.txt
}
on *:EXIT:{ 
  hsave FPM FPM.txt
}
;#### Popups
menu * {
  Text File System
  .Open Dialog:/dialog -vmd FPM FPM
  .File Playing
  ..Input
  ...Enable:/enable #FPM2
  ...Disable:/Disable #FPM2
  ..On Text
  ...Enable:/enable #FPM1
  ...Disable:/Disable #FPM1
}
;#### Setting Alias's
alias ShowTriggers {
  did -r $dname 2
  Var %X $Numtok(%triggers,44)
  var %LoopCounter 1
  while (%LoopCounter <= %X) {
    did -a $Dname 2 $Gettok(%Triggers,%LoopCounter,44)
    inc %LoopCounter
  }
}
alias Triggers {
  return $Gettok(%Triggers,1-,44)
}
alias show#triggers { 
  did -a $dname 24 $Trigger#
}
alias Trigger# {
  unset %Triggercount
  Var %X $Numtok(%triggers,44)
  var %LoopCounter 1
  while (%LoopCounter <= %X) {
    inc %TriggerCount
    inc %LoopCounter
  }
  return %Triggercount
}
Alias Show#Files { 
  did -a $dname 26 $File#
}
alias File# {
  unset %FileCounter
  var %NumExt $numtok(%extensions,44)
  var %LoopCounter 1
  var %LoopCounter2 1
  while (%LoopCounter <= %NumExt) {
    var %Ext * $+ $gettok(%extensions,%LoopCounter,44)
    var %ExtFind $findfile($mircdir,%Ext,0)
    while (%LoopCounter2 <= %ExtFind) {
      var %Path $findfile($mircdir,%Ext,%loopcounter2)
      set %Files $addtok(%Files,$gettok(%path,$numtok(%Path,92),92),44)
      inc %FileCounter
      inc %loopcounter2
    }
    inc %LoopCounter
  }
  return %Filecounter
}
alias trigger { 
  set %trigger $1
  echo -a Trigger Set To %trigger
}
alias FPMlist {
  var %NumExt $numtok(%extensions,44)
  var %LoopCounter 1
  var %LoopCounter2 1
  while (%LoopCounter <= %NumExt) {
    var %Ext * $+ $gettok(%extensions,%LoopCounter,44)
    var %ExtFind $findfile($mircdir,%Ext,0)
    while (%LoopCounter2 <= %ExtFind) {
      var %Path $findfile($mircdir,%Ext,%loopcounter2)
      set %Files $addtok(%Files,$gettok(%path,$numtok(%Path,92),92),44)
      echo -a $gettok(%files,%LoopCounter2,44)
      inc %loopcounter2
    }
    inc %LoopCounter
  }
}
alias Showfiles {
  unset %Files
  did -r $dname 7
  var %NumExt $numtok(%extensions,44)
  var %LoopCounter 1
  var %LoopCounter2 1
  while (%LoopCounter <= %NumExt) {
    var %Ext * $+ $gettok(%extensions,%LoopCounter,44)
    var %ExtFind $findfile($mircdir,%Ext,0)
    while (%LoopCounter2 <= %ExtFind) {
      var %Path $findfile($mircdir,%Ext,%loopcounter2)
      set %Files $addtok(%Files,$gettok(%path,$numtok(%Path,92),92),44)
      did -a $dname 7 $gettok(%files,%LoopCounter2,44)
      inc %loopcounter2
    }
    inc %LoopCounter
  }
}
alias ExtReload {
  did -r $dname 3
  var %x $numtok(%Extensions,44)
  var %z 1
  While (%z <= %x) {
    did -a $dname 3 $gettok(%Extensions,%z,44)
    inc %z
  }
  showfiles
  show#files
  showTriggers
  show#triggers
}
;#### Dialog
dialog FPM {
  title "File Playing Module"
  size -1 -1 443 438
  option pixels notheme
  box "Control", 17, 6 352 434 68
  box "Availble Files", 8, 157 11 125 235
  box "Extensions", 4, 316 10 125 235
  box "Triggers", 1, 5 10 125 235
  list 2, 12 29 110 225
  list 3, 325 29 110 225
  list 7, 164 29 110 225
  box "Control", 11, 160 247 124 51
  button "Add Extension", 12, 325 265 81 25
  button "Delete Extension", 13, 325 293 89 25
  box "Control", 5, 5 245 124 77
  button "Add Trigger", 6, 12 261 65 25
  button "Delete Trigger", 9, 12 288 77 25
  box "Control", 10, 317 246 124 77
  button "Delete File", 14, 169 262 86 25
  text "Trigger:", 18, 17 371 39 17
  text "", 19, 60 372 100 17
  text "File To Play:", 20, 16 396 60 17
  text "", 21, 79 396 100 17
  button "Save", 22, 369 377 65 25
  text "Number Of Triggers:", 23, 13 422 100 17
  text "", 24, 112 423 19 17
  text "Availble Files:", 25, 146 422 67 17
  text "", 26, 213 423 16 17
  link "www.XeroCreative.Com", 27, 320 422 120 17
  button "Refresh", 15, 5 324 435 28
}
;#### Dialog Core
on *:DIALOG:FPM:init:*: {
  extreload
}
on *:DIALOG:FPM:close:*: {
  hsave FPM FPM.txt
}
;#### Button Events
on *:dialog:FPM:SCLICK:*: {
  if ($did == 22) {
    hadd FPM $did(2).seltext $did(7).seltext
  } 
  if ($did == 15) {  extreload } 
  if ($did == 6) { 
    var %x $?"Enter a trigger. Example:!Jokes"
    if (%x == $null) { halt }
    else {
      set %Triggers $addtok(%Triggers,%x,44)
    }
    showtriggers
    show#triggers
  }
  if ($did == 9) {
    set %Triggers $deltok(%Triggers,$gettok(%Triggerinfo,2,124),44)
    hdel FPM $did(2).seltext
    unset %Triggerinfo
    showtriggers
    show#triggers
  }
  if ($did == 2) { 
    Var %x $did(2).seltext 
    set %TriggerInfo $addtok(%x,$findtok(%Triggers,$did(2).seltext,44),124)
    did -a $dname 19 $did(2).seltext
    did -a $dname 21 $Hget(FPM, $did(2).seltext)
  }
  if ($did == 12) { 
    var %x $?"Enter Extension. Example: .txt"
    if (%x == $null) { halt }
    else {
      set %Extensions $addtok(%Extensions,%x,44)
      extreload
    }
  }
  if ($did == 14) { 
    var %x $?!="Are you sure you want to delete $did(7).seltext it will be permantly deleted"
    if (%x == $True) { 
      .remove $qt($findfile($mircdir,$did(7).seltext,1))
      showfiles
    }
    else { 
      halt
    }
  }
  if ($did == 7) { 
    Var %x $did(7).seltext 
    set %FileInfo $addtok(%x,$findtok(%Files,$did(7).seltext,44),124)
    did -a $dname 21 $did(7).seltext
  }
  if ($did == 13) { 
    set %extensions $deltok(%Extensions,$gettok(%Extinfo,2,124),44)
    unset %Extinfo
    extreload
  }
  if ($did == 3) { 
    Var %x $did(3).seltext 
    set %ExtInfo $addtok(%x,$findtok(%extensions,$did(3).seltext,44),124)
  }
}
;#### Playing Files
#FPM1 on
on *:text:*:#: {
  if ($hget(FPM, $1)) { 
    var %x $FindFile($mircdir,$Hget(FPM, $1),1)
    msg $chan $read(%x)
  }
}
#FPM1 end
#FPM2 on
on *:INPUT:*: {
  if ($hget(FPM, $1)) { 
    var %x $FindFile($mircdir,$Hget(FPM, $1),1)
    msg $active $read(%x)
  }
}
#FPM2 end
;#### End File Playing Module

Comments

Sign in to comment.
HeatedHeart   -  Oct 14, 2011

i havent been on in 2 years so..... bump? Want to get back into my old ways so.... rate this? haha

More
 Respond  
HeatedHeart   -  Aug 13, 2009

lol.. ty i guess. And @atr this is better than manualy because you can make multiple triggers for like !jokes !Fact !chucknorris w/e it takes all those !msging scripts and puts them into one. but alas it WAS for a friend and I myself have no use for it. though it could be helpfull in a bot script, or just something fun. idk.

More
 Respond  
PATX   -  Aug 12, 2009

no ur coding is ok and the point is ok. and it was VERY nice.

More
 Respond  
HeatedHeart   -  Aug 12, 2009

So my coding is bad and theres no point to my script? Thats nice ;/

More
 Respond  
PATX   -  Aug 12, 2009
Atr   -  Aug 12, 2009

The idea of it is quite cool, and it looks pretty good..

I don't really have a use for it myself, though what makes it better than doing it manually?

More
 Respond  
HeatedHeart   -  Aug 12, 2009

lol thank you, My poor forsaken scripts never get much attention, I wish they would though so I COULD get some feedback.

More
 Respond  
Atr   -  Aug 12, 2009

I haven't tried it out, but you just looked so lonely and forlorn that I felt I had to put something! :P

More
 Respond  
HeatedHeart   -  Aug 11, 2009

lolz? Nothing else i need to fix? No Rating either? xD

More
 Respond  
Atr   -  Aug 11, 2009

Erm.. it's nice?

More
 Respond  
HeatedHeart   -  Aug 11, 2009

Bump

More
 Respond  
HeatedHeart   -  Aug 10, 2009

Slow to comment today... anyone gona say anything?

More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.