Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   loadlines (https://forums.graalonline.com/forums/showthread.php?t=70698)

coreys 12-10-2006 11:28 PM

loadlines
 
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:
PHP Code:

function onActionServerSide() {
  if (
params[0] == "loadpage") {
    
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:
NPC Code:
<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.
PHP Code:

function loadPage(acc,page) {
  
triggeraction(0,0,"serverside",name,"loadpage",acc,page);
  if (
client.browserview.size() < 2View.text client.broswerview[0];
  else {
    
Browser.View.text NULL;
    for (
i=0i<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

Quote:

Originally Posted by coreys (Post 1252088)
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:
PHP Code:

function onActionServerSide() {
  if (
params[0] == "loadpage") {
    
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:
NPC Code:
<center><h1>Vash-Aniki</h1></center>



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

PHP Code:

function onActionServerSideactionp1p2) {
  switch ( 
action) {
    case 
"loadpage":
      
pl findPlayerp1);
      
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

Quote:

Originally Posted by Stefan (Post 1252657)
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.

Quote:

Originally Posted by coreys (Post 1252107)
I managed to get it to load right, and a sendtorc() displays it right, but MLTextCtrl is just returning 0.
PHP Code:

function loadPage(acc,page) {
  
triggeraction(0,0,"serverside",name,"loadpage",acc,page);
  if (
client.browserview.size() < 2View.text client.broswerview[0]; <- here
  
else {
    
Browser.View.text NULL;
    for (
i=0i<client.browserview.size(); i++) {
      
View.text View.text SPC client.browserview[i];
    }
  }



hmm?


All times are GMT +2. The time now is 03:27 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.