chat - How to save variable after closing mIRC? -


i'm new language , i'm trying code own bot. alredy got basics , manage use variables , aliases, looking forward mini-game in chat in have own pet, name , level up.

i this, problem resides in @ end of day, close program , pets go away, , kind of destroys purpose of it.

i wondering if there way in save these variables , reload them each time open program, maybe save them on .txt?

any suggestion appreciated.

i agree 1 of comments it's best go .ini files problem.

an example of syntax, taken url linked above:

writeini reminder.ini birthday jenna 2/28/1983 writeini reminder.ini birthday mike 10/10/1990 

this produces following file:

[birthday] jenna  = 2/28/1983 mike   = 10/10/1990 

and read this:

echo -a mike: $readini(reminder.ini, n, birthday, mike) echo -a jenna: $readini(reminder.ini, n, birthday, jenna) 

if want more flexibility define own data format, can revert plain text files. basic /write , $read functions have pretty neat functionality: see docs

something should work writing:

; search if pet saved $read(pets.txt,ns,%petname) if ($readn == 0) {     ; append end of file     write pets.txt %petname %age %mood } else {     ; replace line     write -l $readn pets.txt %petname %age %mood } 

to retrieve specific pets:

var %pet_info = $read(pets.txt, ns, %petname) ; split found line on space (ascii-code 32) tokenize 32 %pet_info var %age = $2 var %mood = $3 

this returns line starts petname you're looking for.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -