PDA

View Full Version : loadlines


coreys
12-10-2006, 11:28 PM
I'm trying to use loadlines to make a kind of web browser for txt files in the folder "levels/sites/account_pagename.txt"

I don't really know quite what I'm doing though, and this is just returning 0:
function onActionServerSide() {
if (params[0] == "loadpage") {
a = findPlayer(params[1]);
a.client.browserview.loadLines("sites/"@params[1]@"_"@params[2]@".txt");
sendtorc("Testing browser: "@a.clientr.browserview);
}
}

For testing purposes, params[1] is the account and params[2] is mainweb. So it should be looking up "levels/sites/coreys_mainweb.txt" which does exist. It is:
<center><h1>Vash-Aniki</h1></center>


I've tried both levels/sites/ and just sites/. Neither have worked.

Chompy
12-10-2006, 11:38 PM
I dunno about this, but your loading a.client.browserview, and tries
to echo a.clientr.browserview,

also, a is made into an object by using findplayer, so, it would make:
player's client.browserview into the lines that loadlines load.. I'm guessing thats what you are doing,
but the only thing I see, is that you echo the wrong object

coreys
12-10-2006, 11:47 PM
I managed to get it to load right, and a sendtorc() displays it right, but MLTextCtrl is just returning 0.
function loadPage(acc,page) {
triggeraction(0,0,"serverside",name,"loadpage",acc,page);
if (client.browserview.size() < 2) View.text = client.broswerview[0];
else {
Browser.View.text = NULL;
for (i=0; i<client.browserview.size(); i++) {
View.text = View.text SPC client.browserview[i];
}
}
}

Chompy
12-10-2006, 11:50 PM
When I am changing gui attrs outside the control, or destroying, I usually
do like ( @ parent_gui).destroy();

Just a question, inside MLTextCtrl, you are you using client. etc..?
have you tried to set the client file to a thiso. string and load it as thiso.*?

contiga
12-11-2006, 03:59 PM
I'm trying to use loadlines to make a kind of web browser for txt files in the folder "levels/sites/account_pagename.txt"

I don't really know quite what I'm doing though, and this is just returning 0:
function onActionServerSide() {
if (params[0] == "loadpage") {
a = findPlayer(params[1]);
a.client.browserview.loadLines("sites/"@params[1]@"_"@params[2]@".txt");
sendtorc("Testing browser: "@a.clientr.browserview);
}
}

For testing purposes, params[1] is the account and params[2] is mainweb. So it should be looking up "levels/sites/coreys_mainweb.txt" which does exist. It is:
<center><h1>Vash-Aniki</h1></center>


I've tried both levels/sites/ and just sites/. Neither have worked.

function onActionServerSide( action, p1, p2) {
switch ( action) {
case "loadpage":
pl = findPlayer( p1);
temp.lines.loadLines( "levels/sites/" @ pl.account @ "_" @ p2 @ ".txt");
pl.client.browserview = temp.lines;
echo( pl.client.browserview);
break;
}
}

coreys
12-12-2006, 10:25 PM
It's returning 0 in the echo...o.o

I checked the file with /find...its there...o.o
I don't get it o.o whats wrong? I've tried loadstring() too, that doesn't appear to even do anything...doesn't even return 0.

coreys
12-12-2006, 10:36 PM
Hmmm...weird I tested loadlines() with a gmap in a different folder...it worked then.

But for some reason loadstring() just doesn't work.

coreys
12-12-2006, 10:47 PM
(triple post, yeah)
Ah, I got it to work. =)

Of course, with loadlines, now it'll completely butcher the data in the file whenever theres break (as in someone hit enter) or theres a comma. =/

Admins
12-12-2006, 10:48 PM
Make sure you are accessing the right file by script, echo the filename. Also in your clientside code you have written client.broswerview once, that spelling needs to be fixed.

Chompy
12-13-2006, 12:01 AM
Make sure you are accessing the right file by script, echo the filename. Also in your clientside code you have written client.broswerview once, that spelling needs to be fixed.

I managed to get it to load right, and a sendtorc() displays it right, but MLTextCtrl is just returning 0.
function loadPage(acc,page) {
triggeraction(0,0,"serverside",name,"loadpage",acc,page);
if (client.browserview.size() < 2) View.text = client.broswerview[0]; <- here
else {
Browser.View.text = NULL;
for (i=0; i<client.browserview.size(); i++) {
View.text = View.text SPC client.browserview[i];
}
}
}


hmm?