mIRC Home    About    Download    Register    News    Help

Print Thread
#200685 09/06/08 09:46 PM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I just wanted to know if it was possible and what the code would be if I were to store 1 line of text or more in a hash table just in a single value.

Here is my example

hadd whisper MSG %w

where %w is the following text:

line 1: Hello
line 2: How are you

echo -a text stored was: $hget(Whisper,MSG)

Thanks in advance,

Cheers,

Jay

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Yes and no. You *technically* can store the newline character in hash tables, but you don't want to.

The reason being: storing multiple "lines" in one variable would not be advantageous in most situations because you'd have to prefix a /command to each line anyway, eg:

var %hypothetical_var = LINE1 $+ $crlf $+ LINE2

//msg # %hypothetical_var would msg the channel LINE1 only, and then you would get a message from the server saying "unknown command LINE2"

This is because the IRC server itself doesn't handle multiple lines either. Each line is one command- so every line needs a command prefixing the data.

This is the same for /echo-- it can only echo one line at a time. In this case you would just see LINE1 <weird block character> LINE2 on one line, because it ignores newline characters. There is no way to echo multiple lines with one /echo command, so storing it that way is not helpful.

Instead, just store the lines in multiple variables:

hadd -m table line.1 = line1
hadd -m table line.2 = line2

and loop over $hget(table,line. $+ %i)


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
I guess I should have probably clarified a bit more prior to just handing a random code. What I wanted to do was using a method to store the text of a query request until I have either "Accepted" or "Declined" it. I would like to capture the users text before I accept and when I do it will then be displayed in the query window. So all I wanted to do was capture all of the text the user has sent me, store it, and then display it.

I hope that helps a bit more.

Thanks a bunch.

Cheers,

Jay

Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Simply hide the window (window -h, /help /window) and then show it if you have accepted or close it.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard