nguyenbason Posted May 30, 2009 Share Posted May 30, 2009 (edited) I have the following file:*MonsterFile "char\monster\Monsen\Monsen.ini" *JapaneseName "½ë" *Name "Sen" *Level 7 *Type Neutral *EXP 270 *HP 22 *Damage 3 6 *Fire 10 *Ice -5 *Good -5 //±¸ºÐ ( CYCLOPS / HOBGOBLIN / IMP / MINIG / PLANT / SKELETON / ZOMBI / OBIT ) *Effect SEN *DropNumber 1 *Drop 525 Gold *Drop 4235 µ· 200 350 *Drop 1199 pl101 ps101 pl101 *Drop 1799 da102 da202 wa101 wh101 wm101 ws101 wp101 om101 pl101 ps101 or101 *Drop 959 da103 da203 wa102 wc102 wh102 wm102 ws102 ws202 wp102 om102 or102 oa102 os102 *Drop 480 da104 da204 wa103 wc103 wh103 wm103 ws103 ws203 wp103 om103 or103 oa103 os103 *Drop 240 wa104 wc104 wh104 wm104 ws104 ws204 wp104 om104 or104 oa104 os103 gp109 *NameFile "name\6_Sen.zhoon"I'm making a editor for this file. And for each flag i want to display the value of that flag in each input controle.i: flag *Name will display the value Sen into input control.I do this by using _FileReadToArray function. Like this_FileReadToArray("Seto.inf",$a) _ArrayDelete($a,0) For $i = 0 To UBound($a) - 1 If StringLeft($a[$i],5) = "*Name" Then $b = StringTrimLeft($a[$i],5);Delete *Name from array $b = StringReplace($b,@TAB,'');Remove TAB from array $b = StringReplace($b,'"',''); Remove " GuiCtrlSetData($MobName,$B);assign to input control EndIf NextoÝ÷ ا©òjºÚÊfrazÇÈeG®{«wéÝ¡ûayø¥xz0q©âv+)¬é¢æÇ©j¶z)éº×(Úèh^ âµëh~)^jëh×6_FileReadToArray("Seto.inf",$a) _ArrayDelete($a,0) For $i = 0 To UBound($a) - 1 If StringLeft($a[$i],5) = "*Name" Then $NewMobName = GuiCtrlRead($MobName);Read new name $a[$i] = '*Name' & @TAB & @TAB & @TAB & '"' & $NewMobName & '"';modify it EndIf Next _FileWriteFromArray("Seto.inf",$a)Same problem with read when many array match the search like *Drop (7 match near end of the file)... How to write down for each input control? And Advance question: Have any other way to make it easier? (Like iniread and iniwrite function for e.g)Thanks, Edited June 1, 2009 by nguyenbason UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
Bert Posted May 31, 2009 Share Posted May 31, 2009 You are trying to read a file that is written in a format that notepad does not understand. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
nguyenbason Posted May 31, 2009 Author Share Posted May 31, 2009 No. You are misunderstanding. Because the file is Japanese so if i read it i will display like that. My problem is how to read and write if multiline have same flag. UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
nguyenbason Posted May 31, 2009 Author Share Posted May 31, 2009 any other help please? Thanks UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
nguyenbason Posted June 1, 2009 Author Share Posted June 1, 2009 (edited) Ok. I edited the file for easier to understand. with my ongoing way. I think i will use second array to display and edit: $DropRage = _ArraySearch($a,"*Drop") _ArrayDelete($DropRage,0,) For $j = 0 To UBound($DropRage) $c = StringTrimLeft($DropRage[$j],5);Delete *Drop from array $c = StringReplace($c,@TAB,'|') ; Replace Tab by | $c = StringSplit($c,"|") _ArrayDelete($c,0) GuiCtrlSetData($DropRate1,$c[2]);assign to input control GuiCtrlSetData($DropItem1,$c[3]);assign to input control Next Same way while save to the file. So my question is: Have any better way to do this? Edited June 1, 2009 by nguyenbason UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
nguyenbason Posted June 10, 2009 Author Share Posted June 10, 2009 Oh, no news. Anyway, thanks all for reading me UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now