CLEO Help Detect/Read/Add

CLEO related
Status
Not open for further replies.

WillSay

Member
Joined
Sep 7, 2016
Messages
12
Reaction score
0
Hello , i have a file .ini ( save a chatlog ) i want make a cleo to read (ini file ) if have a new chatline in (ini) then say blabla... please help
 

WillSay

Member
Joined
Sep 7, 2016
Messages
12
Reaction score
0
supahdupahnubah said:
WillSay said:
supahdupahnubah said:
Show whatcha got so far

Just open file ini and read , if have newline then add to chat...

Show us the code, the code that you got so far, otherwise no one will spoonfeed you

Code:
0BE3: raknet setup_incoming_rpc_hook @chat

:test
wait 0  

if
31@ == 1
then
31@ = 0
chatmsg "newlineonchat" -1
end
jump @First

:chat
0BE5: raknet 29@ = get_hook_param PARAM_PACKETID
if 29@ == RPC_ScrClientMessage
if and
26@ = File.Open("cleo\test.txt", 114)
24@ = File.Size(26@)
File.ReadString(26@, 25@, 24@)
24@ += 1 
then
31@ = 1
end
0BE0: raknet hook_ret true

Here , i dont know about check file ,
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
I don't understand anything, you can use 0AAB to check if a file exists, alternatively you can pass 'at+' flag to file open, to append text to the file, and create the file if it doesn't exists already.

Code:
File.Open("cleo\test.txt",  "at+")
 

WillSay

Member
Joined
Sep 7, 2016
Messages
12
Reaction score
0
springfield said:
I don't understand anything, you can use 0AAB to check if a file exists, alternatively you can pass 'at+' flag to file open, to append text to the file, and create the file if it doesn't exists already.

Code:
File.Open("cleo\test.txt",  "at+")

Simple: 

In the ini file have
1= A ( old )
2= B (old )
3= C (old)
4= 1 ( new )

Cleo will check if have new line in the ini file , then it will chatmsg , if old do nothing
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
WillSay said:
Code:
0BE3: raknet setup_incoming_rpc_hook @chat

:test
wait 0  

if
31@ == 1
then
31@ = 0
chatmsg "newlineonchat" -1
end
jump @First

:chat
0BE5: raknet 29@ = get_hook_param PARAM_PACKETID
if 29@ == RPC_ScrClientMessage
if and
26@ = File.Open("cleo\test.txt", 114)
24@ = File.Size(26@)
File.ReadString(26@, 25@, 24@)
24@ += 1 
then
31@ = 1
end
0BE0: raknet hook_ret true

Here , i dont know about check file ,

Lol, have you even compiled it successfully?
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
It's not a good idea to open the file and read from it everytime you get a chat message.
So, first thing first, open the file once, read the last line once, then in the message hook, compare the new line with the old line, if they don't match, write the new line to file(open the file with append), and update the variable that holds the last message string.

You can loop with 0AD6/0AD7 to get the last string in the file.
 

WillSay

Member
Joined
Sep 7, 2016
Messages
12
Reaction score
0
springfield said:
It's not a good idea to open the file and read from it everytime you get a chat message.
So, first thing first, open the file once, read the last line once, then in the message hook, compare the new line with the old line, if they don't match, write the new line to file(open the file with append), and update the variable that holds the last message string.

You can loop with 0AD6/0AD7 to get the last string in the file.

Yes that exactly what i want , can you give me a simple code?? i dont know begin where
 

Strechea

Active member
Joined
Jan 26, 2017
Messages
28
Reaction score
2
Use getchatstring, alloc for it, get last string from ini compare it with new string, if string is same with new do nothing, else write new string.
 
Status
Not open for further replies.
Top