James Posted December 28, 2006 Posted December 28, 2006 (edited) OK, so my last topic wasn't my last because of this. When you chose a menu colour, it writes it to a .ini : [MenuColour] NewColour=Blue Right? Now what I need is to make a function which will read the value of the key and set the colour of the menu. I tried this: Func ReadMenuColor() $DefMenu = IniReadSection("Settings.ini", "MenuColour") If StringInStr($DefMenu), "Default") Then SetDefaultMenuColors() EndIf EndFunc But it didn't work. Secure Edited December 28, 2006 by Secure_ICT Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Valuater Posted December 28, 2006 Posted December 28, 2006 $DefMenu = IniReadSection("Settings.ini", "MenuColour") returns an array use iniread() **************** also it wont work because the value is "blue" not "default" 8)
James Posted December 28, 2006 Author Posted December 28, 2006 Func ReadMenuColor() $DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour") If StringInStr($DefMenu), "Blue") Then SetBlueMenuColors() EndIf EndFunc That doesn't work either. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Valuater Posted December 28, 2006 Posted December 28, 2006 this should give an error $DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour") it should have 4 values $DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour", "Default") read the help file 8)
Thatsgreat2345 Posted December 28, 2006 Posted December 28, 2006 Func ReadMenuColor() If StringInStr(IniRead("Settings.ini", "MenuColour", "NewColour",""), "Blue") Then SetBlueMenuColors() EndIf EndFunc why are you using stringinstr? why not just check if it equals blue
James Posted December 28, 2006 Author Posted December 28, 2006 Thanks ThatsGreat! Works perfect, and now I know how to make Setting files. Valuater: I have read the helpfile, but I couldn't make it work. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Valuater Posted December 28, 2006 Posted December 28, 2006 if you are going to shorten it then.. Func ReadMenuColor() If StringInStr(IniRead("Settings.ini", "MenuColour", "NewColour",""), "Blue") Then SetBlueMenuColors() EndFunc 8)
Thatsgreat2345 Posted December 28, 2006 Posted December 28, 2006 For like Multiple colors you can create your function and implement parameters to it. Global $colors[5] = ["Red","Blue","Yellow","Green","Purple","Orange"] Func ReadMenuColor() For $i = 0 To UBound($colors) - 1 If IniRead("Settings.ini", "MenuColour", "NewColour","") = $colors[$i] Then SetMenuColors($colors[$i]) Next EndFunc or you can throw in an exitloop but its only going to equal one color so keeping it to a short one liner i assume would be fine
Valuater Posted December 28, 2006 Posted December 28, 2006 For like Multiple colors you can create your function and implement parameters to it. Global $colors[5] = ["Red","Blue","Yellow","Green","Purple","Orange"] Func ReadMenuColor() For $i = 0 To UBound($colors) - 1 If IniRead("Settings.ini", "MenuColour", "NewColour","") = $colors[$i] Then SetMenuColors($colors[$i]) Next EndFunc oÝ÷ Úò¢çØk£§jw±Ùh¢î¶+l¢yr§Úªæ¥¢w¢Z+²z§+m¡«!¢»hébêâjË.ì(ºW[yø§{ú®¢×¢Á«-)äx-ëìÊ+lyé¬Êé)à~éܶ*'±ú+y§!rh' çÚº[Lz{¢Z+±'[1éî h®Çsrl¶Þ¶¢Z+½©nz¶êí©íéÚ쨺¯x×° hº 8)
Thatsgreat2345 Posted December 28, 2006 Posted December 28, 2006 i was thinking the same way ; it seems you are making functions for each color SetDefaultMenuColors() SetBlueMenuColors() etc......... why not store the color value rather than the name, you have NewColour=Blue just make that the actual color value NewColour=0x0fff?? ; (for Blue) Then Func ReadMenuColor() $DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour", "Default") If StringInStr($DefMenu), "Default") Then SetDefaultMenuColors() Else SetMenuColors($DefMenu) ; pass the color value to the function EndIf EndFunc 8) Lol yeah I was thinking that but I was to lazy to go look up the Hex Values so I decided names were good enough
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