Author Topic: its me again cut script  (Read 11928 times)

Julian`d`Child

  • Newbie
  • *
  • Posts: 20
its me again cut script
« on: February 10, 2007, 12:40:10 AM »
this script is supposed to check the post and if the post is over 420 characters.. automatically post the 420+ characters that are left.. this is an edited mIRC script.. can any one help me get it working?



Quote

on 1:input:*:if ($len($1-) > 420)
%pos = 420
:loop
if %pos < 390 goto end |
%chara = $mid($1-,%pos,1)
if $asc(%chara) == 32 goto end |
%pos = %pos - 1
goto loop
:end
%first = $left($1-,%pos - 1)
%cuttext = $remove($1-,%first)
%prefix = $left(%first,4)
%mtch = /me
if (%prefix == %mtch)  %metxt = $remove(%first,%mtch) | /me %metxt


i get the following message with the code
Quote
[02:32]  ->> ERROR:modScriptEval:0:Function:Tokenize Error Number:9 : Subscript out of range
[02:32]  ->> ERROR:modScriptEval:0:Function:doEval:$1- Error Number:9 : Subscript out of range

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: its me again cut script
« Reply #1 on: February 10, 2007, 10:30:38 AM »
Yes, that will not work at all in IceChat 7.
There is no $len(), no $left(), etc etc.

This will have to be re-written using the IceChat 5 (VB Script) style scripting, using the OUTTEXT function.

I get the feeling your gonna ask how to do it, so I may as well try and make it myself. :)
« Last Edit: February 10, 2007, 11:39:20 AM by Snerf »
The IceChat God

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: its me again cut script
« Reply #2 on: February 10, 2007, 11:58:17 AM »
So, this code also checks if the length is greated then 420, and just tries and cut it at the 1st space after position 390. Hopefully you dont use many 30 letter words, if so, just cut it back from the 390 in the Instr() line.
This needs to be saved as an IceChat 5 Script, so use Save As in the Script editor.

Code: [Select]
Function OUTTEXT(OutGoingText)
If Len(OutGoingtext) > 420 then
    pos = Instr(390,OutGoingText, " ")
    part1 = Left(OutGoingText,pos)
    part2 = Mid(OutGoingText,pos)
    SendCommand "/say " & part1
    SendCommand "/say " & part2
    OutText = ""
Else
    OutText = OutGoingText
End if
End Function
The IceChat God

Julian`d`Child

  • Newbie
  • *
  • Posts: 20
Re: its me again cut script
« Reply #3 on: February 10, 2007, 03:56:18 PM »
thank you Snerf.. it works almost like the other one, except on actions.. if you give me a hint on how to do that you will have my eternal devotion..

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: its me again cut script
« Reply #4 on: February 10, 2007, 06:47:32 PM »
Thats an easy fix, just need to add a check to see if there is a /me.

Code: [Select]
Function OUTTEXT(OutGoingText)
If Len(OutGoingtext) > 420 then
    pos = Instr(390,OutGoingText, " ")
    part1 = Left(OutGoingText,pos)
    part2 = Mid(OutGoingText,pos)
    if left(lcase(part1),3)="/me" then
      SendCommand "/me " & mid(part1,4)
      SendCommand "/me " & part2
    else
      SendCommand "/say " & part1
      SendCommand "/say " & part2
    end if
    OutText = ""
Else
    OutText = OutGoingText
End if
This message brought to you by the Wonderful Wizard of Oz.

Julian`d`Child

  • Newbie
  • *
  • Posts: 20
Re: its me again cut script
« Reply #5 on: February 11, 2007, 02:43:56 PM »
Thank you Darkstar though you for got to end function in your quote, which is the limit of my knowledge in VB script..
Quote
Function OUTTEXT(OutGoingText)
If Len(OutGoingtext) > 420 then
    pos = Instr(390,OutGoingText, " ")
    part1 = Left(OutGoingText,pos)
    part2 = Mid(OutGoingText,pos)
    if left(lcase(part1),3)="/me" then
      SendCommand "/me " & mid(part1,4)
      SendCommand "/me " & part2
    else
      SendCommand "/say " & part1
      SendCommand "/say " & part2
    end if
    OutText = ""
Else
    OutText = OutGoingText
End if
End Function

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: its me again cut script
« Reply #6 on: February 11, 2007, 03:18:40 PM »
Oops, yes, simply a copy and paste error. :)
This message brought to you by the Wonderful Wizard of Oz.

Alex_

  • Newbie
  • *
  • Posts: 2
Re: its me again cut script
« Reply #7 on: February 06, 2013, 04:36:52 PM »
Hi guys.
Breathing life into an old topic.
When using this script the consul reports the following error:
 -- Script Engine Error:5:Invalid procedure call or argument: 'Mid': Line #5 --
It's especially frustrating as I actually succeeded in finding this (I think it was this one >.< ) cutoff script about a year ago and getting it to work. Must be my old age :)

Looking forward to some sagely wisdom.

Thanks for your time,
Alex_
(For clarity, I am attempting to use the modified script Darkstar provided.)


Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: its me again cut script
« Reply #8 on: February 06, 2013, 04:43:26 PM »
Does it just report this error when you are saving the font?
The IceChat God

Alex_

  • Newbie
  • *
  • Posts: 2
Re: its me again cut script
« Reply #9 on: February 07, 2013, 08:16:00 AM »
No sir, the saving is no issue, it's when I attempt to use it.

Of additional interest may be that for normal text the script functions perfectly (as in to say it performs and does not generate an error), it is only when using the /me command for text that may be cutoff that the error is generator and the text cut off as normal.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: its me again cut script
« Reply #10 on: February 07, 2013, 02:09:11 PM »
OK, thanks for the additional info, certainly helps with debugging.
Will give it a try, and see if I can replicate the error.
The IceChat God

Loralai

  • Newbie
  • *
  • Posts: 4
Re: its me again cut script
« Reply #11 on: July 20, 2013, 06:14:11 PM »
This script works great for me accept I tried adding on to it to make it post more than a second 4 line section of text. (I play games that require I make posts that are a bit longer than this script allows and they always cut off.) However, Wen I got to the third section, it would always re-post half of the second section with it(within the third section), then just two more lines. I tried time and time again to make it work but I had no luck and I'm not very good with Icechat's languages.

Can anyone help with a cut script that allows even more text to be entered?

Possibly an add on to be pasted into the existing script here to make it the length desired by whom ever?

Much thanks!

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: its me again cut script
« Reply #12 on: July 22, 2013, 04:10:12 PM »
How long is your text. its cutting it at 390 characters currently, are you pasting like 1000 characters?
The IceChat God

Loralai

  • Newbie
  • *
  • Posts: 4
Re: its me again cut script
« Reply #13 on: July 26, 2013, 08:23:02 PM »
If it's cutting at 390 and that's half of the posted post then my posts are likely around 900 or so letters. After section 2 I added a section 3 and it seemed to work by putting it at right but it always added half of the second section to the third section. No matter hat I tried I couldn't fix it. Essentially I just wanted to try for a three part paste script instead of 2.

I'll try to edit the script again and post it here to show what I mean.
« Last Edit: July 26, 2013, 08:27:56 PM by Loralai »

Loralai

  • Newbie
  • *
  • Posts: 4
Re: its me again cut script
« Reply #14 on: July 26, 2013, 08:51:06 PM »
Quote
  Function OUTTEXT(OutGoingText)
    If Len(OutGoingtext) > 450 then
        pos = Instr(390,OutGoingText, " ")
        part1 = Left(OutGoingText,p)
        part2 = Mid(OutGoingText,pos)
        part3 = Right(OutGoingText,pos)
        SendCommand "/say " & part1
        SendCommand "/say " & part2
        SendCommand "/say " & part3
        OutText = ""
    Else
        OutText = OutGoingText
    End if
    End Function
    Function OUTTEXT(OutGoingText)
    If Len(OutGoingtext) > 420 then
        pos = Instr(390,OutGoingText, " ")
        part1 = Left(OutGoingText,pos)
        part2 = Mid(OutGoingText,pos)
        part3 = Right(OutGoingText,pos)
        if left(lcase(part1),3)="/me" then
          SendCommand "/me " & mid(part1,4)
          SendCommand "/me " & part2
          SendCommand "/me " & part3
        else
          SendCommand "/say " & part1
          SendCommand "/say " & part2
          SendCommand "/say " & part3
        end if
        OutText = ""
        Else
        OutText = OutGoingText
    End if
    End Function
    Function OUTTEXT(OutGoingText)
    If Len(OutGoingtext) > 420 then
        pos = Instr(390,OutGoingText, " ")
        part1 = Left(OutGoingText,pos)
        part2 = Mid(OutGoingText,pos)
        part3 = Right(OutGoingText,pos)
        if left(lcase(part1),3)="/me" then
          SendCommand "/me " & mid(part1,4)
          SendCommand "/me " & part2
          SendCommand "/me " & part3
        else
          SendCommand "/say " & part1
          SendCommand "/say " & part2
          SendCommand "/say " & part2
        end if
        OutText = ""
        Else
        OutText = OutGoingText
    End if
    End Function



See how there is a part 3 but it repeats the text from part 2. If you mess with the numbers you can change things up so it doesn't repeat as much but it always seem's to repeat no matter here I move the numbers too. I don't know the language that Icechat uses so I probably have no chance of getting this right but a third part would be epic to me. Friends of mine have had this same problem but didn't want to make accounts to see if it could be done :/  Thanks for your help!