Re: Fastest Way to...

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello, can someone tell me what is wrong with this?  I'm using the hackserv
as a basis for a mud.  I've tried to change it to accomodate telnet, gmud,
zmud, etc..(basically any client) where it only supported telnet in the
beginning. I KNOW this is too much code..but i've just been adding stuff in
trying to make it work and nothing seems to work. I KNOW that I'm
overlooking something really easy..but I can't figure it out.  Can someone
tell me  if you know what is wrong with this?

 elsif action = FD_READ then   -- The client said somethin'
    junk = ""
    owork = ""
    while not match({CRLF},junk) do
      owork = WsockReadData(sock,1)
      if atom(owork) then
        exit
      end if
      if length(owork)<1 then
  exit
      end if
      if atom(owork) then
        exit
      end if
      if length(owork)<1 then
  exit
      end if
      junk = junk & owork

end while
    -- junk now contains the client's responce

    -- find this user in our list
    iwork = getUserFromSocket(sock)



 if length(players)>0 then
   for x=1 to length(players) do
 if players[x][1]=sock then
  charnum=x
 end if
   end for
  end if

players[charnum][6]=players[charnum][6]&junk

    if compare({10},players[charnum][6][(length(players[charnum][6]))]) or
compare({13},players[charnum][6][length(players[charnum][6])]) then

if compare({10},players[charnum][6][length(players[charnum][6])]) then

players[charnum][6]=players[charnum][6][1..(length(players[charnum][6])-1)]
end if

if compare({13},players[charnum][6][length(players[charnum][6])]) then

players[charnum][6]=players[charnum][6][1..(length(players[charnum][6])-1)]
end if

if compare({10},players[charnum][6][length(players[charnum][6])]) then

players[charnum][6]=players[charnum][6][1..(length(players[charnum][6])-1)]
end if
junk=players[charnum][6]

warnErr("junk:"&sprint(junk))

players[charnum][6]=""
call_proc(players[charnum][7],{sock,junk})
junk=""
end if


Thank you in advance,

Michelle



----- Original Message -----
From: "C. K. Lester" <euphoric at cklester.com>
To: <EUforum at topica.com>
Sent: Monday, October 27, 2003 11:34 PM
Subject: Re: Fastest Way to...


>
>
> Pete Lomax wrote:
>
> >>Okay, here's my attempt:
> >>
> >>junk =3D pos <=3D 0
> >>pos =3D pos * junk
> >>pos +=3D not junk
> >>
> >>
> >That's about 3 times slower.
> >
> >In your first post, you "unrolled the loop" which is a classic way to
> >make something as fast as possible.
> >
> >Pete
> >
> >
> hey, Pete, thanks for that info. I later realized that it won't be a
> static size sequence, so I have to accommodate all sizes.
>
> I bet looping through the sequence when length() is more than ? would be
> faster than the sequence operations... right?
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu