|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
One line of my dialog: edit "", 11, 18 42 409 288, multi return vsbar
on *:DIALOG:test:sclick:16: { write txt/file.txt $1 } How can i save the text which is in editbox in my file.txt ..??
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
I have other problem! If i click on ITEM it dont open a dialog... I use this: on *:DIALOG:pieraksts:sclick:11: { /dialog -m about_ about_ }
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Jul 2005
Posts: 22
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 22 |
Can you tell me how did yo save a file which is in editbox in to your file.txt ?
i have a problem with that
|
|
|
|
Joined: Jan 2003
Posts: 249
Fjord artisan
|
Fjord artisan
Joined: Jan 2003
Posts: 249 |
use /savebuf and /loadbuf to save/load whole contents of edits in dialogs
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
If you want to save text from an editbox in a custom dialog, you use:
/write file.txt $did($dname,ID).text
Note tha you if you're in a dialog event, you can reduce this down to:
/write file.txt $did(ID)
ID is the ID of your editbox.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Jul 2005
Posts: 22
Ameglian cow
|
Ameglian cow
Joined: Jul 2005
Posts: 22 |
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
I've editbox with multi and vsbar functions! How can i save all lines in file.txt and read all lines in that editbox.. I make Notepad!
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Use a loop like this:
set %cnt 1
while (%cnt <= $did(NAME,ID).lines) {
write file.txt $did(NAME,ID,%cnt)
}
unset %cnt
Info: $did(NAME,ID).lines = # of lines in your multiline edit box $did(NAME,ID,N) = Text from line N NAME = Your dialog name. If called within a dialog event, you can use $dname, or even just leave that off altogether. ID = ID of the edit box
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
it doesnt works.. if i write 2lines it save that text which is in editbox 2times ... editbox: 1line - hey!! bfffffff..... 2line - How are you?
In file.txt - Hey!! bff How are you? Hey!! bff How are you?
And how i can read all lines in editbox
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Can you paste the code around where you inserted this so I can see how you're calling it? It sounds like you have another loop going on.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
on *:DIALOG:pieraksts:sclick:16: {
set %cnt 1
while (%cnt <= $did(pieraksts,11).lines) {
write file.txt $did(pieraksts,11,%cnt)
}
unset %cnt
}
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
I'm sorry... it's my fault... I always forget to include INC. Here:
set %cnt 1
while (%cnt <= $did(NAME,ID).lines) {
write file.txt $did(NAME,ID,%cnt)
inc %cnt
}
unset %cnt closed code tags
Last edited by Mentality; 29/07/05 11:33 AM.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
Ok, that's work.. But on open a dialog how can i read all text in editbox???
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
On open, the only text in an edit box is text you put there. You don't need to read it since you already know what it is. The only way there's text there is if you put it in the dialog's edit "____" part when creating it, or if you use /did -a to stick it in there on init.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
You don't understand.. I open the dialog write in text in the big editbox then press OK button and it save the text in file.txt .. I close the dialog..!! I need that when i open the dialog again the text will be in the editbox!
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Ok, I see what you mean.
on *:dialog:NAME:init:*: {
did -a $dname ID $read(file.txt)
}
Replace NAME and ID and change the filename. Note that if you are adding many lines to a multiline edit box, you'll need to put in a loop to read in every line in the file.txt...
on *:dialog:NAME:init:*: {
set %cnt $lines(file.txt)
while (%cnt >= 1) {
did -i $dname ID 1 $read(file.txt,%cnt)
dec %cnt
}
unset %cnt
}
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
I have one more question ..!! How can i read lenght in all lines not only in $did(ID,1 or 2 ...)
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
You'll have to do a loop $did(NAME,ID).lines is total lines, so loop from 1 to that using a WHILE loop and add up all the lengths.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Feb 2005
Posts: 74
Babel fish
|
OP
Babel fish
Joined: Feb 2005
Posts: 74 |
ehh... i cant find a right way to make it work. I have this:
set %l $did(11).lines
while (%l <= $did(11)) {
did -a pieraksts 19 $did(11,%l).len
inc %l
}
unset %l
[color:red]m[color:blue]IRC[color:green] for EvEr
|
|
|
|
|