How To
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

How To

Started by EXNET OWNER, 01 September, 2004, 14:25:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

EXNET OWNER

I have a bot with the following variables and i am having no luck at creatniga working .ini file so that the variables are read from the file rather than the script. Could someone please make create a .ini file for a bot witht the following variables, thankyou...

BotName = "-???OwL???-"
Description = ""
Connection = "DSL"
Version = "0.500"
Mode = "A"
HubsOp = "1"
HubsReg = "0"
HubsGuest = "0"
Slots = "3"
Tag = "<++ V:"..Version..",M:"..Mode..",H:"..HubsGuest.."/"..HubsReg.."/"..HubsOp..",S:"..Slots..">"
Email = "None"
Share = 6958739042 -- In Bytes not KB, MB or GB

I hope somoen could help me as I am finding this really hard :)

Psycho_Chihuahua

can u post the script to?


Otherwise check get Black_Pearl to read settings from cfg file for a similar example
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

nErBoS

#2
Hi,

Simple as this...

fSetting = "setting.ini" -- Path of the file

function Main()
assert(dofile(fSetting),"File Setting.ini was not Found.")
end

Best regards, nErBoS
--## nErBoS Spot ##--

BottledHate

this is one way to load settings from an ini style file.

--//LUA4 / PTOKAX
readfrom("yourfile.bleh")
while 1 do
   local line = read()
   if (line == nil) then
      break
   else
      if strsub(line,1,9) =="Status =" then
         setting1=strsub(line,9,srlen(line))
      elseif strsub(line..........................
         setting2=strsub(line...............
      end
end
readfrom()

this show u 'HOW TO' do it. it does not do it for you.  

saveing in an ini style file.
--BotName = "-???OwL???-" 
--Description = "" 
--Connection = "DSL" 
--Version = "0.500" 

function inistyledata()
local tmp = ""
local tmp = "[Settings]\r\n"..
                     "BotName = "..BotName.."\r\n"..
                     "Description = "..Description.."\r\n"..
                     "Connectoin = "..Connectoin.."\r\n"..
                     "Versoin = "..Versoin.."\r\n"
return tmp
end

local f,e = openfile( "yourfilename.bleh", "w+" ) 
   if f then
     write(f, inistyledata() )
     closefile(f)
   end

Is the ini file for the user of the script to change??? or just for saving data... if it is just for saving data i recommend putting all you data in 1 table, and user serialization to save and dofile() to load. much faster and more reliable than the way you are doing it now.

i'm working on a lil 'how to' for saving and loading strings and tables, and creating files and paths..... keep an eye out for it.


:D

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

SMF spam blocked by CleanTalk