Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help. "Input String Too Large For String Variable"
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
macaboo




PostPosted: Tue Apr 27, 2004 6:38 am   Post subject: Help. "Input String Too Large For String Variable"

I Found someone's IRC program on here for turing and i added some stuff to it, but i get this error when i join certain channels "Input String Too Large For String Variable", what does that mean, and how can i fix it? I attached the irc client that i added to, please someone help.


irc.t
 Description:
That is the prog

Download
 Filename:  irc.t
 Filesize:  7.64 KB
 Downloaded:  112 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Flashkicks




PostPosted: Tue Apr 27, 2004 7:20 am   Post subject: (No subject)

I would if i could download the program but I am at school; HENCE I CAN NOT DOWNLOAD- WE ARE NOT ALLOWED...Sad That is why i still feel that since this is a Help Thread- we should/you should post source code for it.. not downloadable coding..but i guess its all tha same- Just some peolpes cant get access to it..Sad
Dan




PostPosted: Tue Apr 27, 2004 11:01 am   Post subject: (No subject)

i did not look at your code yet, but the error is probly being cause b/c turing has a limint (around 255 letters) for how long a string can be. one way around this whould be to make a way to dected how long a string is going to be then breaking it up in to smaller ones. also you could basicly make your own string system by making a array of chars.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
macaboo




PostPosted: Wed Apr 28, 2004 7:19 am   Post subject: Same thing, here is my code

ok here is the code

code:

var data, svr, name, channel, pass, server, topic, op, opchan, choice, msg, towho, whois, ctcp, whoctcp, serversion, remember : string
var modechan, modes, invitewho, invitechan, kickwho, kickchan, me, deop, deopchan, kickreas, dns, userhost, away, quitreason, target, message : string
var ns, port : int
var stremin, stremout : int

%initialize some variables
name := "default"
server := "default"

%set the screen, background color and text color
View.Set ("graphics:600,400, nobuttonbar")
Text.ColorBack (16)
Text.Color (0)
drawfill (1, 1, black, black)

%i dont feel like commenting this whole program right now
open : stremin, "nick.ini", get
loop
    exit when eof (stremin)
    get : stremin, name
end loop
close : stremin
if name = "default" then
    put "Nickname: " ..
    get name
    open : stremout, "nick.ini", put
    put : stremout, name
    close : stremout
end if
open : stremin, "server.ini", get
loop
    exit when eof (stremin)
    get : stremin, server
end loop
close : stremin
if server = "default" then
    put "Server: (d for default [efnet]) : " ..
    get server
    if server = "d" or server = "D" then
        server := "irc.efnet.org"
        put "Remember this for next time [y/n] " ..
        get remember
        if remember = "y" or remember = "Y" then
            open : stremout, "server.ini", put
            put : stremout, server
            close : stremout
        end if
    end if
end if
put "Channel: #" ..
get channel

cls
function returnword (s : string, separator : char, n : int) : string
    var wi := 0
    var s2 := ""
    for i : 1 .. length (s)
        if wi >= n then
            if s (i) = separator then
                result s2
            end if
            s2 += s (i)
        end if
        if s (i) = separator then
            wi += 1
        end if

    end for
    if s2 not= "" then
        result s2
    else
        result "Couldn't find that many words!"
    end if

end returnword

function returnwords (s : string, separator : char, n : int) : string
    var wi := 0
    var s2 := ""
    for i : 1 .. length (s)
        if wi >= n then
            s2 += s (i)
        end if
        if s (i) = separator then
            wi += 1
        end if

    end for
    if s2 not= "" then
        result s2
    else
        result "Couldn't find that many words!"
    end if

end returnwords

proc parse (data : string)
    if returnword (data, " ", 0) = "PING" then
        put : ns, "PONG ", returnword (data, " ", 1)
    elsif returnword (data, " ", 1) = "376" then     %376
        put : ns, "JOIN ", "#", channel
    elsif returnword (data, " ", 1) = "475" then
        put "Enter Channel Password: " ..
        get pass
        put : ns, "JOIN ", "#", channel, " ", pass
    elsif returnword (data, " ", 1) = "473" then
        put "Cannot Join Channel (Invite Only)"
    elsif returnword (data, " ", 1) = "PRIVMSG" then
        put "<", returnword (data, "!", 0) (2 .. *), "> ",
            returnwords (data, " ", 3) (2 .. *)
    else
        put data %set this with a ".." if i want it to all be on the same gay fuckin line which is gay
    end if
end parse
ns := Net.OpenConnection (server, 6667)
put : ns, "USER ", name, " echeese echeese :echeese"
put : ns, "NICK ", name
loop
    if Net.CharAvailable (ns) then
        get : ns, data : *
        parse (data)
    end if
    if hasch then
        get data : *
        if data = "/join" or data = "/JOIN" then
            put "Channel: #" ..
            get channel
            put : ns, "JOIN ", "#", channel
            if returnword (data, " ", 0) = "475" then
                put "Enter Channel Password: " ..
                get pass
                put : ns, "JOIN ", "#", channel, " ", pass
            end if
        elsif data = "/leave" then
            put : ns, "PART ", "#", channel
        elsif data = "/server" then
            put "Server: " ..
            get server : *
            Net.CloseConnection (ns)
            ns := Net.OpenConnection (server, 6667)
            put : ns, "USER ", name, " echeese echeese :echeese"
            put : ns, "NICK ", name
        elsif data = "/nick" or data = "/NAMES" then
            put "Nick: " ..
            get name
            put : ns, "NICK ", name
        elsif data = "/names" or data = "/NAMES" then
            put : ns, "NAMES ", "#", channel
        elsif data = "/topic" or data = "/TOPIC" then
            put "Topic: " ..
            get topic : *
            put : ns, "TOPIC ", "#", channel, " :", topic
        elsif data = "/msg" or data = "/MSG" then
            put "Message: " ..
            get msg : *
            put "To: " ..
            get towho
            put : ns, "privmsg ", towho, " :", msg
        elsif data = "/whois" or data = "/WHOIS" then
            put "Who: " ..
            get whois
            put : ns, "WHOIS ", whois
        elsif data = "/ctcp" or data = "/CTCP" then
            put "PING|VERSION|TIME| : " ..
            get ctcp
            if ctcp = "PING" or ctcp = "ping" then
                put "Who: " ..
                get whoctcp
                put : ns, "PING ", whoctcp
            elsif ctcp = "version" or ctcp = "VERSION" then
                put : ns, "VERSION "
            elsif ctcp = "TIME" or ctcp = "time" then
                put : ns, "TIME "
            else
                put "That choice is invalid."
            end if
        elsif data = "/mode" or data = "/MODE" then
            loop
                put "Choose Modes(h for list): " ..
                get modes : *
                if modes = "h" or modes = "H" then
                    put "b (mask) - Ban mask from channel."
                    put "i - Invite only channel."
                    put "k (key) - Channel key (password) needed to join."
                    put "l (number) - Limit users in channel."
                    put "m - Moderated."
                    put "n - No external messages."
                    put "o (nick) - Ops a user."
                    put "p - Private channel."
                    put "s - Secret. the channel will not be listed at all."
                    put "t - Only ops set topic."
                    put "v (nick) - Voice."
                end if
                exit when modes > "h" or modes < "H"
            end loop
            put : ns, "MODE ", "#", channel, " ", modes
        elsif data = "/invite" or data = "/INVITE" then
            put "Invite Who: " ..
            get invitewho
            put : ns, "INVITE ", invitewho, "#", channel
        elsif data = "/kick" or data = "/KICK" then
            put "Kick Who: " ..
            get kickwho
            put "Reason(n for none): " ..
            get kickreas : *
            if kickreas = "n" or kickreas = "N" then
                kickreas := ""
            end if
            put : ns, "KICK ", "#", channel, " ", kickwho, " ", kickreas
        elsif data = "/away" or data = "/AWAY" then
            put "Reason: " ..
            get away : *
            put : ns, "AWAY ", away
        elsif data = "/quit" or data = "/QUIT" then
            put "Reason: " ..
            get quitreason : *
            put : ns, "QUIT ", quitreason
        elsif data = "/notice" or data = "/NOTICE" then
            put "Target: " ..
            get target
            put "Message: " ..
            get message
            put : ns, "NOTICE ", target, " ", message
        elsif data = "/userhost" or data = "/USERHOST" then
            put "Who: " ..
            get userhost
            put : ns, "USERHOST ", userhost
        elsif data = "/help" or data = "/HELP" then
            put "1.) Command List"
            put "2.) About MacIRC"
            get choice
            if choice = "1" then
                put "blah blah command list"
            elsif choice = "2" then
                color (yellow)
                put "Created by a guy on a forum, modified"
                put "and added to by the one and only     "
                put "Macaboo, msg me on IRC. My nick will "
                put "Either be macaboo or _MACABOO.       "
            end if
        elsif data = "/op" or data = "/OP" then
            put "Who: " ..
            get op
            put : ns, "MODE ", "#", channel, " +o ", op
        elsif data = "/deop" or data = "/DEOP" then
            put "Who: " ..
            get deop
            put : ns, "MODE ", "#", channel, " -o ", deop
        elsif data = "/disconnect" or data = "/disconnect" then
            Net.CloseConnection (ns)
        else
            put : ns, "privmsg ", "#", channel, " :", data
        end if
    end if
end loop
macaboo




PostPosted: Wed Apr 28, 2004 7:21 am   Post subject: Oh i forgot

you must have a "nick.ini" and a "server.ini" in the same folder as this because i wanted to save something to a file, which is really stupid and im going to take it out but its too late now, i posted the code so just create those, unless you guys can also tell me how to create a file when there isnt one there already, like not writing or reading from a file, creating one... but thats not important right now, thanks
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: