Author Topic: **Reading** Text Files Using Functions  (Read 2628 times)

Instead of starting a new topic i'll use this old one.

How would i go about reading a text files. I need to know how to read different lines, and sections of those lines. I also need to know how to make a GUI to pop up useing a slash command function.

Thanks for all the help so far.
« Last Edit: June 05, 2007, 05:23:46 PM by Flea »

Thank you for your help Rudyman.

Variable for persons name depends on what arguments you got, heres a few things it could be:

Code: [Select]
%client.name
%obj.client.name

There the ones i usually use.

There's %client.netname and %client.lanname too, I think. %client.name is whichever one they are currently using. You could also store files by BL_ID.

I think you need %file.save(%path); too. Could be wrong.

That explains why my files had that...thanks.

Neither worked, but i made a gui i just need the slash command to show it.

Like:
/ShowGui
(Gui Pops Up)

Nothing special you see.

Oh and whats %i I see it alot in code, but i dont know what it is or what its for.

Thanks for eveyones help so far.
« Last Edit: June 06, 2007, 11:48:11 AM by Flea »

As far as I know, the GUI is broken and will not work for anyone but the host.

If you are trying to set the text on a GUI remotely:

Add-Ons/Client/GUIHello_client.cs
Code: [Select]
function clientcmdGUIset(%obj,%text)
{
 %obj.setText(%text);
}

function clientcmdopenGUI(%obj,%gui)
{
 canvas.pushDialog(%gui);
}

function guiHello::onWake(%this)
{
 commandtoserver('updateHelloGUI');
}

Add-Ons/Hello.cs
Code: [Select]
function servercmdShowGUI(%client)
{
 commandtoclient(%client,'openGUI',"guiHello");
 commandtoclient(%client,'GUIset',txtHello,"Hello " @ %client.name);
}

... Where guiHello is created by you with one control, "txtHello" as a MLTextCtrl.

Anyone who has both files and the "guiHello" GUI added can type /showGUI on your server, have it pop up and have info sent to it i.e. "Hello Space Guy" would appear using the code above if I typed /showGUI.

So what your saying is i'd have to have a gui to see it if i was on someone elses server?

Yes. Ephialtes was working on a 'safe' GUI downloader (not code, just sending "BUTTON x y width height" etc) but it seems to have dissapeared. It would be helpful to have. Maybe I could add something like that with a "Do you want to download GUI: RPGLoginGUI?" message, etc.