How to make a script write to a file?
|
|
Joakim Yakan
Fast learner
Join date: 2 Oct 2006
Posts: 31
|
10-04-2006 08:15
Hello!
Maybe someone else have asked about this before, but I couldn't find any posts about my question. Well, I wonder how I can make my script write to a file. I would like to make some kind of a vote-script where avatars can say their names and the script will write those names into a file which I later can have a look at.
Any suggestions?
Joakim =)
|
|
ZenMondo Wormser
Registered User
Join date: 19 Mar 2006
Posts: 26
|
10-04-2006 08:36
There is no way (as far as I know) to do this in LSL. There is unfortunatly no llWriteNotecardLine.
What you would have to do is create a list in your script, and append it with the names, then put in a mechanism where the script will read the list to you.
There is a free visitor-list maker script out there that you could probably tear apart and rebuild into what you want.
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
10-04-2006 08:42
Apart from the inworld solution mentioned above you can also send out http messages. You can use, say, Apache and the PHP engine on your local machine to receive those messages and process them or have them write to a file. Kinda roundabout but better get used to it 
|
|
Joakim Yakan
Fast learner
Join date: 2 Oct 2006
Posts: 31
|
10-04-2006 08:55
From: HtF Visconti Apart from the inworld solution mentioned above you can also send out http messages. You can use, say, Apache and the PHP engine on your local machine to receive those messages and process them or have them write to a file. Kinda roundabout but better get used to it  Can this also be done by sending it to a remote computer, not only the local one?
|
|
Julianna Scott
Registered User
Join date: 26 Aug 2005
Posts: 8
|
Use lists
10-04-2006 09:31
Use a listen to get the data you want the user to type in. The listen saves what is typed to a string. Take a look on the wiki at lists. You can add a comma and the string to the list and it will be saved in a list. there are a lot of list functions that let you add to the list, delete, take a value from just part of a list, find particular data, etc. You can then convert the list to a string and spit it back out to yourself with a say command later.
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
10-04-2006 10:17
From: Julianna Scott Use a listen to get the data you want the user to type in. The listen saves what is typed to a string. Take a look on the wiki at lists. You can add a comma and the string to the list and it will be saved in a list. there are a lot of list functions that let you add to the list, delete, take a value from just part of a list, find particular data, etc. You can then convert the list to a string and spit it back out to yourself with a say command later. I'd use a menu myself. that way people don't add in false data using /say, the vote is private (no need to worry about people listening in on channels with scripts), and you can throw back the data on current vote percents after the vote is made in a private way as well.
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|
|
Don Misfit
Registered User
Join date: 1 Jun 2006
Posts: 60
|
10-04-2006 10:51
Joakim... For persistent storage, you need to send the data 'off-world.' The two ways to do this are: 1) email - the scripted object sends a standard email message (to your RL email address, for example) 2) http - the scripted object uses llHTTPRequest() and sends data to a web server. The web server then stores the data (text, xml, database, etc.) HtF Visconti's suggestion of Apache and the PHP engine on your local machine assumes that you don't have a web site for method 2. Don
|
|
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
|
10-04-2006 11:22
From: Joakim Yakan Can this also be done by sending it to a remote computer, not only the local one? Well - it is http  So, yes, any webserver will do that can receive requests and process them and, of course, you're not stuck with PHP you can also use Perl, ASP and whatnot. I was only assuming that you probably had no website and would have to make one on the fly and this is best done by oneself at home  If you have access to a website and/or a second computer it would, of course, be the better choise. Keep in mind that not your client playing SL is sending the message but that the Linden server is sending the message so your http post/put must go to a server the Linden server(s) can reach - i.e. it must have a valid IP address. I merely point this out because your use of "local computer" made me think you were perhaps thinking that your local client sent the message, which is not the case.
|
|
Joakim Yakan
Fast learner
Join date: 2 Oct 2006
Posts: 31
|
10-04-2006 12:02
Thanks to all of you who answered me, this helped me alot! Your answers were exactly what I was looking for. *thumbs up*
|
|
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
|
Menus Chat!
10-06-2006 07:54
From: Senuka Harbinger I'd use a menu myself. that way people don't add in false data using /say, the vote is private (no need to worry about people listening in on channels with scripts), and you can throw back the data on current vote percents after the vote is made in a private way as well. Menus use chat channels to communicate with the script, so, people can still add in false data using /say [unless you use a negative channel, and ways exist to do it then, too, with scripts], and scripts can still listen in. Indeed, your menu-using script uses Listens to listen to the menu! [It * HAS* to, as there is no other way.] The menu is a secure way of communicating to the user, but so is llInstantMessage, which chats to the target resident only.
|
|
Oasis Perun
Registered User
Join date: 2 Oct 2005
Posts: 128
|
10-10-2006 12:15
From: Llauren Mandelbrot Menus use chat channels to communicate with the script, so, people can still add in false data using /say [unless you use a negative channel, and ways exist to do it then, too, with scripts], and scripts can still listen in. Indeed, your menu-using script uses Listens to listen to the menu! [It *HAS* to, as there is no other way.] The menu is a secure way of communicating to the user, but so is llInstantMessage, which chats to the target resident only. Aren't negative channels just the higher end of the norm channels but a signed instead of unsigned integer?
|
|
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
|
No Negativity Allowed
10-10-2006 12:41
From: Oasis Perun Aren't negative channels just the higher end of the norm channels but a signed instead of unsigned integer? Yes, but because they are over the maxint value, we cannot access them with the /32 Say Something on Channel 32 format in the chat line. We would have to specify them as negative values, which does not work either.
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
10-11-2006 00:24
fairly secure since there are over 2 billion negative channels.
|
|
Sloan McCoy
Registered User
Join date: 16 May 2004
Posts: 10
|
10-11-2006 00:39
why not have some kinda booth they walk up to or in , and just use a visitor script in it?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-11-2006 09:48
This is one of the primary uses of my (Not Quite) Notecard Generation feature idea. I still have to create a voting proposal for this, but in the meantime feel free to leave feedback and support:
|