Sign in to follow this  
Followers 0
Glyph

Need a way of adding a string to an array then use it later

5 posts in this topic

#1 ·  Posted (edited)

heres what i got and doesnt work:

Dim $connectedip[1]
$connectedip[0]=""

dim $i=0
dim $y=0
dim $c=0



; user connected
case $data= StringRegExp($data, $connect,0) = 0
        $msg=StringTrimLeft($data, 10)
        $msg2=StringSplit($data,"|")
if $data <> "" Then
_ArrayAdd($connectedip[$y],$msg2[2])
$c=$c+1
EndIf

do
            $y=$y+1
            UDPSend(UDPOpen($connectedip[$y], 2008),$connectout&"|"&$msg2[3])
            sleep(10)
            GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" - [out] "&$connectedip[$y]&" "&$connectout&"|"&$msg2[3]&@CRLF&GUICtrlRead($chatbox))      
            
until   $y=$c
            $y=$y-$c
            
       GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" [Event] User Connect: "&$msg2[3]&@CRLF&GUICtrlRead($chatbox))          
                UDPSend(UDPOpen($connectedip[$y], 2008),".connected.|"&$msg2[3])

        _ArrayAdd( $avArray, GUICtrlCreateTreeViewitem($msg2[3], $userbox))

        $i=$i+1





; got a messege
case $data= StringRegExp($data, $messagein,0) = 0
$msg2=StringSplit($data,"|")

if $data <> "" Then
$c=$c+1
EndIf
GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" - [in] "&$msg2[2]&@CRLF&GUICtrlRead($chatbox))
do
            $y=$y+1
            UDPSend(UDPOpen($connectedip[$y], 2008),".messaged.|"&$msg2[2])
GUICtrlSetData($chatbox,@HOUR&":"&@MIN&":"&@sec&" - [out] "&$msg2[2]&@CRLF&GUICtrlRead($chatbox))
            
            
until   $y=$c
            $y=$y-$c
Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites

heres what i got and doesnt work:

...which is OK if it's not meant to do anything. :)

All seriousness aside, define "doesn't work". What was it supposed to do, and what's it doing instead?

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Your case statements don't appear valid:

case $data= StringRegExp($data, $connect,0) = 0

case $data= StringRegExp($data, $messagein,0) = 0

Compare one side or the other.

Share this post


Link to post
Share on other sites

lol. i should have added. sorry.

but heres what isn't working:

$connectedip[$y]

it returns -1 -.-


tolle indicium

Share this post


Link to post
Share on other sites

lol. i should have added. sorry.

but heres what isn't working:

$connectedip[$y]

it returns -1 -.-

Look at the help file for _ArrayAdd(). The first parameter is the array to add another element to, and therefore cannot have a subscript. So, for example, _ArrayAdd($connectedip[$y],$msg2[2]) should be _ArrayAdd($connectedip,$msg2[2]).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0