Author Topic: Ini_Module, Return the name of [Bracket]  (Read 620 times)

Mötley

  • Full Member
  • ***
  • Posts: 316
  • Karma: +32/-31
  • Scripter
    • View Profile
Ini_Module, Return the name of [Bracket]
« on: September 19, 2016, 05:16:26 pm »
So without returning the wrong amount of parameters, Is it possible to Return the name of the [Bracket]

I will create an example, Note this example would never work, It's just to give you the concept.

Code: [Select]
local name = ReadIniString( "Accounts.ini", player.Name ); //Missing player.Name, "Text" );
MessagePlayer( "Welcome Back: "+name, player);


A Ini file layout

Quote
[Bobby]
Password = 460cf46d9cba83de5380fe06166229854e4bed53
Kills = 17970
Deaths = 10234
Cash = 3
Skin = 84


I hope you understand the concept, If so you might understand why I am doing this.
Any help for this Discussion is appreciated.

ARSEnic.

  • Newbie
  • *
  • Posts: 43
  • Karma: +11/-14
  • Hell o!
    • View Profile
Re: Ini_Module, Return the name of [Bracket]
« Reply #1 on: September 28, 2016, 08:17:25 am »
I have tried the same but apparently it dosen't work so I gave up and just did something like ReadIni(bla, bla, "names"); and just added a comma in between the string to separate them, then i use .find() to see if its in "names"

Vortrex

  • Full Member
  • ***
  • Posts: 261
  • Karma: +51/-53
  • Developer for Argonath RPG
    • View Profile
Re: Ini_Module, Return the name of [Bracket]
« Reply #2 on: October 10, 2016, 11:54:31 am »
Why would you want to?
You already know the player name, so why grab it from the Ini just to say hello? Seems like a waste of resources to me.
Developer for Argonath RPG's LU server.

Mötley

  • Full Member
  • ***
  • Posts: 316
  • Karma: +32/-31
  • Scripter
    • View Profile
Re: Ini_Module, Return the name of [Bracket]
« Reply #3 on: October 11, 2016, 03:10:05 am »
I no longer code for LU due to The Worst server receiving many horible attacks after Theremin finnally released the update

"We were also getting a Nice player base"

I managed to incorporate other methods.

This is a SHITY script, With a terrible usage of a Variable Scope But I managed to grab that bracket, As well increase it. This script can be taken as a joke "I did not really mess with it but for maybe 20 minutes", But for the bracket NO,

Just store the brackets in a global and assign an initial value player.Name, etc, etc.

Code: [Select]
Objects <- "Portland";
function LoadMaps(){

print("Installing Maps");
Objects = "Portland";
for( local i = 0; i <= GetObjectCount(); i++ )
{
local object = FindObject(i);
local count = 0;

if (Objects == "Portland")
{
local model = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "Model" );
local world = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "World" ),
x = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "X" ),
y = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "Y" ),
z = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "Z" ),
rx = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "RX" ),
ry = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "RY" ),
rz = ReadIniFloat( "Scripts/Worst/Objects/Portland.ini", ""+Objects+""+i+"", "RZ" );
local ob = CreateObject( model, Vector( x, y, z ) );
ob.Angle = Vector( rx, ry, rz );
ob.VirtualWorld = world;
if (i == 124) {
i++;
i += count;
print("Installed "+Objects+" "+i+"");
i = 0;
Objects = "Shoreside";
}
}

if (Objects == "Shoreside") {
local model = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "Model" );
local world = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "World" ),
x = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "X" ),
y = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "Y" ),
z = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "Z" ),
rx = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "RX" ),
ry = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "RY" ),
rz = ReadIniFloat( "Scripts/Worst/Objects/Shoreside.ini", ""+Objects+""+i+"", "RZ" );
local ob = CreateObject( model, Vector( x, y, z ) );
ob.Angle = Vector( rx, ry, rz );
ob.VirtualWorld = world;
if (i == 119) {
i++;
i += count;
print("Installed "+Objects+" "+i+"");
i = 0;
Objects = "Staunton";
}
}

if (Objects == "Staunton") {
local model = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "Model" );
local world = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "World" ),
x = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "X" ),
y = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "Y" ),
z = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "Z" ),
rx = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "RX" ),
ry = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "RY" ),
rz = ReadIniFloat( "Scripts/Worst/Objects/Staunton.ini", ""+Objects+""+i+"", "RZ" );
local ob = CreateObject( model, Vector( x, y, z ) );
ob.Angle = Vector( rx, ry, rz );
ob.VirtualWorld = world;
if (i == 29) {
i++;
i += count;
print("Installed "+Objects+" "+i+"");
i = 0;
Objects = "Finnished Installing Maps";
print(Objects);
}
}

}
}
/*
// This was just a crappy script to convert the xml to Ini,  wasn't intended to be pretty just good enough to convert without me really doing anything
function SaveMap()
{
for( local i = 0; i <= GetObjectCount(); i++ )
{
local object = FindObject(i);
if ( object )
{
local x = object.Pos.x, y = object.Pos.y, z = object.Pos.z;
local rx = object.Angle.x, ry = object.Angle.y, rz = object.Angle.z;
local world = object.VirtualWorld;
local model = object.Model;
// Set values
WriteIniInteger( "Scripts/Worst/Objects/Object.ini", "Staunton"+i+"", "Model", model );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini", "Staunton"+i+"", "X", x );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini", "Staunton"+i+"", "Y", y );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini",  "Staunton"+i+"", "Z", z );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini", "Staunton"+i+"",  "RX", rx );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini",  "Staunton"+i+"", "RY", ry );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini",  "Staunton"+i+"", "RZ", rz );
WriteIniFloat( "Scripts/Worst/Objects/Object.ini", "Staunton"+i+"",  "World", world );
}
}

}*/
« Last Edit: October 11, 2016, 03:22:54 am by Mötley »

 

© Liberty Unleashed Team.