IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: Julian`d`Child on February 10, 2007, 12:40:10 AM

Title: its me again cut script
Post by: Julian`d`Child 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
Title: Re: its me again cut script
Post by: Snerf 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. :)
Title: Re: its me again cut script
Post by: Snerf 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
Title: Re: its me again cut script
Post by: Julian`d`Child 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..
Title: Re: its me again cut script
Post by: DarkStar 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
Title: Re: its me again cut script
Post by: Julian`d`Child 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
Title: Re: its me again cut script
Post by: DarkStar on February 11, 2007, 03:18:40 PM
Oops, yes, simply a copy and paste error. :)
Title: Re: its me again cut script
Post by: Alex_ 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.)

Title: Re: its me again cut script
Post by: Snerf on February 06, 2013, 04:43:26 PM
Does it just report this error when you are saving the font?
Title: Re: its me again cut script
Post by: Alex_ 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.
Title: Re: its me again cut script
Post by: Snerf 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.
Title: Re: its me again cut script
Post by: Loralai 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!
Title: Re: its me again cut script
Post by: Snerf 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?
Title: Re: its me again cut script
Post by: Loralai 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.
Title: Re: its me again cut script
Post by: Loralai 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!
Title: Re: its me again cut script
Post by: Morio on July 27, 2013, 02:46:05 AM
The reason it repeats is that the Mid() function does not work the way you think it does. It can be used to return a string with specific length from within another string, but unless you you specify the length of the message, it will just return everything after the starting position

Code: [Select]
Mid(String, Start, Length)
Code: [Select]
Mid("Hello World", 3, 5)

Would return "llo W"


Mid("Hello World", 3)

Would return "llo World"


Also, the Right() function returns a number of characters from the end of the string, so it won't work properly in this script, unless you would calculate the cut position from the right side for the last part of the script (which I think would be a bit pointless).

I would suggest that for longer messages you could make a loop that cuts the first ~400 characters from a string and posts it and then makes a new string from the remaining characters and repeats the process until the whole message is posted.


Something like:

Code: [Select]
Do While Length(SomeString) > 400
    MessageString = Left(SomeString, 400)
    SendCommand "/say " & MessageString
    SomeString = Mid(SomeString, 401)
Loop

You could of course add the same kind of code to make the script cut the message at a space, like in the script you have already
Title: Re: its me again cut script
Post by: Loralai on July 27, 2013, 11:31:09 PM
Just as a foreword, forgive me because I'm bound to sound dense here while not knowing the language.

So What you are saying is that I could utilize the existing script as first posted here without the section 3 and then add the loop at the end as you have posted it? So essentially I would need to find the point where it cuts off then put the number in that loop script and it would use the first script regularly and then cut from the end to repost it?
Title: Re: its me again cut script
Post by: Morio on July 28, 2013, 05:01:20 AM
Just as a foreword, forgive me because I'm bound to sound dense here while not knowing the language.

So What you are saying is that I could utilize the existing script as first posted here without the section 3 and then add the loop at the end as you have posted it? So essentially I would need to find the point where it cuts off then put the number in that loop script and it would use the first script regularly and then cut from the end to repost it?

Almost the whole script could be replaced by that loop. The script you have already looks for a space after the 390th character, and cuts the message at that point rather than cutting in the middle of a word. Just add the part that decides where to cut the text inside the loop