Thornhunt
Active Members-
Posts
178 -
Joined
-
Last visited
Thornhunt's Achievements
Prodigy (4/7)
0
Reputation
-
Hi guys im currently writing a programme that helps me quickly edit item attributes in my server data files while allowing to quickly ammend there categories spawn rates ect the server likes XML and silly me forgot its not as simple as HTML as writing it in a text file (in my defence its 5am and i been quickly trying to write this out since last night) So i have to some how convert my code below, to write into a XML file i have looked up the XML udf, and it make no sence i dont even know were to start as its not as simple as convert or write this line, can someone help? P.s i know its sloppy coding, just really late in the day lol P.s.s Just fixed some missing "" in the text output in my script, just incase you guys notice it in the below Code : Func Build() SplashTextOn("Loading","Building file Please Wait!",500,100) FileDelete ( @ScriptDir & "/types.xml") FileWrite ( @ScriptDir & "/types.xml", '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' ) FileWrite ( @ScriptDir & "/types.xml", " <types>") $aArray = IniReadSectionNames(@ScriptDir & "/Data.ini") If Not @error Then For $i = 1 To $aArray[0] FileWrite ( @ScriptDir & "/types.xml", ' <type name=' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Name","??") & '>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Nominal","") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <nominal>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Nominal","")&'</nominal>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Lifetime","") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <Lifetime>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Lifetime","")&'</Lifetime>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Restock", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <Restock>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Restock","")&'</Restock>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"min", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <min>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"min","")&'</min>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Quantmin", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <Quantmin>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Quantmin","")&'</Quantmin>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Quantmax", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <Quantmax>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Quantmax","")&'</Quantmax>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Cost", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <Cost>' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Cost","")&'</Cost>') FileWrite ( @ScriptDir & "/types.xml", ' <flags count_in_cargo="0" count_in_hoarder="" count_in_map="0" count_in_player="0" crafted="0" deloot="0"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Category", "") <> "" then FileWrite ( @ScriptDir & "/types.xml", ' <category name=' & IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Category","")&'/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Shelves", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <tag name="shelves"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Floor", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <tag name="floor"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Mil", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Military"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Police", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Police"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Farm", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Farm"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"School", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="School"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Industrial", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Industrial"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Hunting", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Hunting"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Village", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Village"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Prison", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Prison"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Firefighter", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Firefighter"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Office", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Office"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Medic", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Medic"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Town", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Town"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Coast", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <usage name="Coast"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Tier1", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <value name="Tier1"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Tier2", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <value name="Tier2"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Tier3", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <value name="Tier3"/>') if IniRead(@ScriptDir & "/Data.ini",$aArray[$i],"Tier4", "") = 1 then FileWrite ( @ScriptDir & "/types.xml", ' <value name="Tier4"/>') FileWrite ( @ScriptDir & "/types.xml", " </type>") Next EndIf FileWrite ( @ScriptDir & "/types.xml", " </types>") EndFunc XML example: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <types> <type name=ACOGOptic> <nominal>60</nominal> <Lifetime>7200</Lifetime> <Restock>1800</Restock> <min>16</min> <Quantmin>-1</Quantmin> <Quantmax>-1</Quantmax> <Cost>100</Cost> <flags count_in_cargo="0" count_in_hoarder="" count_in_map="0" count_in_player="0" crafted="0" deloot="0"/> <category name=weapons/> </type> <type name=AgaricusMushroom> <Lifetime>900</Lifetime> <flags count_in_cargo="0" count_in_hoarder="" count_in_map="0" count_in_player="0" crafted="0" deloot="0"/> </type> <type name=AK101> <nominal>20</nominal> <Lifetime>10800</Lifetime> <Restock>1800</Restock> <min>4</min> <Quantmin>-1</Quantmin> <Quantmax>-1</Quantmax> <Cost>100</Cost> <flags count_in_cargo="0" count_in_hoarder="" count_in_map="0" count_in_player="0" crafted="0" deloot="0"/> <category name=weapons/> <value name="Tier2"/> <value name="Tier3"/> </type> Ini Example ["ACOGOptic"] Name="ACOGOptic" Category="weapons" Nominal=60 Lifetime=7200 Restock=1800 min=16 quantmin=-1 quantmax=-1 cost=100 Military=1 ["AgaricusMushroom"] Name="AgaricusMushroom" Lifetime=900 ["AK101"] Name="AK101" Category="weapons" Nominal=20 Lifetime=10800 Restock=1800 min=4 quantmin=-1 quantmax=-1 cost=100 Tier2=1 Tier3=1 Military=1 cheers in advance
-
Ahhhh It was me then haha Cheers, will pop it in when I get home thanks
-
Thornhunt reacted to a post in a topic:
String Split fileread
-
Cheers. I did that at the start but the issue was that array (2) should contain "{build_version="343524"" Wich I can then use in another stringsplit or am I missing something?
-
Hi guys, looking to strip a 6mil + character file into sectrions that i can manage, my thoughts were the following snippet would allow me to split the sections up however it doesnt seem to split the string?? am i forgettign something, i feel that its something simple.... or am i just loosing the plot... MsgBox(0,"",$sFile) ;===========this correctly shows the file path $FileData = FileRead($sFile) MsgBox(0,"",StringLeft($fileData,100)) ;=============shows the correct 100 chars If @error then Err(3) ;============ doesnt trigger (this is a error function to show a msg box thats custom) $splitMeta = StringSplit($fileData,"meta=") MsgBox(0,"",$splitMeta[2]) ; ====================returns blank!!!!!!!!!!!!!!!!! ;;;;;;;;; i would then run a further x number of splits to break the string down into half ;;;;;; $splitInfo = StringSplit($splitMeta[2],"info=") ;;;;;; _ArrayDisplay($splitInfo,"test") error in console is (150) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: at first i thought maybe it was too but even a file containing this doesnt work
-
this would normally work though some of the keys contain multiple span tags or have the span tags first then the required data after. Cheers though This looks promising as usual Melb, will test when I get home as I'm currently sat on a train lol. Will keep you guys updated
-
ok i have a rather large database and i wanted to clean it up a little (remove the unneeded html) so i wipped to gether a little prog to do it for me as the database has 53000 sections alone never mind the keys for each section the script i wrote should basicly; read the string, find the text inbetween said html replace that text, then replace the said html then rewrite to the ini file EG piece of data [winnable] 1= Possible to win or achieve: <span class="illustration">a winnable election campaign; winnable games.</span> 2= capable of being won: <span class="illustration"> a winnable war.</span> string = Possible to win or achieve: <span class="illustration">a winnable election campaign; winnable games.</span> after first replace string = Possible to win or achieve: <span</span> after second replace string = Possible to win or achieve: new data [winnable] 1= Possible to win or achieve: 2= capable of being won: <span class="illustration"> a winnable war.</span> however it is returning like this [winnable] 1= 2= capable of being won: <span class="illustration"> a winnable war.</span> any chance a second pair of eyes could help me ? #include <Array.au3> #Include <String.au3> $ini = "data.ini" $secnames = IniReadSectionNames ($ini) For $i = 1 To $secnames[0] step 1 $key = IniReadSection($ini,$secnames[$i]) for $p = 1 To $key[0][0] step 1 $sb = _StringBetween($key[$p][1],'<span', '</span>') For $x = 0 to UBound($sb) - 1 step 1 $key1 = StringReplace($key,$sb[$x],"") $key2 = StringReplace($key1,"<span","") $key3 = StringReplace($key2,"</span>","") IniWrite($ini,$secnames[$i],$key[$p][0],$key3) next Next Next
-
Improve a simple loop to control click.
Thornhunt replied to Hyflex's topic in AutoIt General Help and Support
WinClose() ? any help -
is it possible to integrate the facebook chat api https://developers.facebook.com/docs/chat/ into autoit ?
-
anyone ?
-
an old friend said to me, a dll is like the fridge when your making a toast. you have the bread and the toaster ready, but you have to call into the fridge to get the butter
-
ok im trying to use this string : $oForm = _IEFormGetObjByName ($oIE, "falala") normall this would work, as it did for this form <form method="POST" action="balba" id="login_form" onsubmit="return Event.__inlineSubmit(this,event)"> however the second hasnt got a id, is it possible to use the class instead ? <form class="checkpoint" action="/checkpoint/" method="post" onsubmit="return Event.__inlineSubmit(this,event)"> if you require a little more infomation or the means feel free to ask thanks in advance //edited, would a <div id= suffice instead of the form id ?
-
it works fine now, glad i could help p.s sorry for the late reply
-
just a note, with the 'html' held if i press the 'ž' button it opens internet explorer
-
Mouse click to send "Continue, Exit" message
Thornhunt replied to Jadog's topic in AutoIt General Help and Support
jadog, just a little note of advice you could look into. put a timeout on the "continue, exit" screen. if the user wanted to take control then he or her will hit exit in the allowed time, if it was triggered from something else like a twinkie thrown across the room in rage then it wont be frozen on the screen till you realise what has gone of. -
thankyou for the feedback, its probially a good job i chose to make a strategy instead of a rts update: i added the start of a server to sort out new registrants. it also contains some already registered members, so you can play some more (in a sence) with user name availability. there is also some communication from the client to the server side of things (kinda) [Download file updated] P.s The Server log file aka Slog.ini isnt included, because it can become quite large after a while