Raised This Month: $51 Target: $400
 12% 

Menu creation from config file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 01-30-2017 , 16:53   Menu creation from config file
Reply With Quote #1

I made a report plugin. Report are being written to a file. And i want see in game. How make Menu creation from config file?
__________________
vortex. is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-30-2017 , 17:57   Re: Menu creation from config file
Reply With Quote #2

What exactly you need help with? Loading config or creating menu?
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 01-30-2017 , 19:37   Re: Menu creation from config file
Reply With Quote #3

I have a config file. Creating this file menu. Lines menu creation, one by one.
__________________
vortex. is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 01-31-2017 , 05:34   Re: Menu creation from config file
Reply With Quote #4

The simplest way to do what you want is to create a while loop that adds a menu item for each entry in your config file. How you plan to read your config file depends on it's current structure i.e. raw text, key values, etc.
Kolapsicle is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 01-31-2017 , 05:43   Re: Menu creation from config file
Reply With Quote #5

I want key values file read. But i didnt make. Can you send me example?
__________________
vortex. is offline
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 01-31-2017 , 06:33   Re: Menu creation from config file
Reply With Quote #6

Here's an example looping a file named reports.txt which reads the key "reason" from each section.

PHP Code:
char kvFile[128];
BuildPath(Path_SMkvFilesizeof(kvFile), "configs/reports.txt");
KeyValues kv = new KeyValues("Reports");
kv.ImportFromFile(kvFile);

char buffer[192];
if (
kv.GotoFirstSubKey(true)) {
    do {
        
kv.GetString("reason"buffersizeof(buffer), "No Reason Stated.");
        
// add menu items here
    
} while (kv.GotoNextKey(true));
}

delete kv
Here is what reports.txt contains

Spoiler

Last edited by Kolapsicle; 01-31-2017 at 06:41.
Kolapsicle is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 01-31-2017 , 06:40   Re: Menu creation from config file
Reply With Quote #7

Hey, add me on steam please.
__________________
vortex. is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 01-31-2017 , 06:50   Re: Menu creation from config file
Reply With Quote #8

Do not use steam chat to solve your scripting problems... Use this forum, so others can learn from it...
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.
KissLick is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 01-31-2017 , 07:07   Re: Menu creation from config file
Reply With Quote #9

This is not about the issue.
__________________
vortex. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode