Post: Very Helpful Menu Base Script [C#]
06-20-2014, 03:02 PM #1
Sticky
Mary J Wannnnna
(adsbygoogle = window.adsbygoogle || []).push({}); Hey NGU Members!

This function here counts the amount of new lines you have in a string so that you don't have to hard code a bunch of integers for each sub menu I had released this function already in my BOII menu base but I thought I would release this individually so that it can help more people, just set a variable somewhere in your code like so...

    
public static int[] MaximumScroll = new int[12];


    
public static string[] MenuTextStructure(int Client, int MenuID)
{
if (MenuID == 0)
{
return new string[] { "Sub Menu 1", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 1)
{
return new string[] { "Sub Menu 2", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 2)
{
return new string[] { "Sub Menu 3", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 3)
{
return new string[] { "Sub Menu 4", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 4)
{
return new string[] { "Sub Menu 5", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 5)
{
return new string[] { "Sub Menu 6", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 6)
{
return new string[] { "Sub Menu 7", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 7)
{
return new string[] { "Sub Menu 8", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == Cool Man (aka Tustin)
{
return new string[] { "Sub Menu 9", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
else if (MenuID == 9)
{
return new string[] { "Sub Menu 10", "Option 1\nOption 2\nOption 3\nOption 4\nOption 5\nOption 6\nOption 7\nOption 8" };
}
return new string[] { "", "" };
}

public static int MaxScroll(int Client, int MenuID)
{
int ScrollNum = 0;
foreach (char NewLines in MenuTextStructure(Client, MenuID)[1])
{
if (NewLines == '\n'Winky Winky
{
ScrollNum++;
}
}
return ScrollNum;
}


then on a timer, multi-thread, or background worker set...

    
for (int i = 0; i < 12; i ++)
{
MaximumScroll[i] = MaxScroll(i, /*Menu ID integer*/);
}

The following 7 users say thank you to Sticky for this useful post:

04jberry, Absolute Zero, Azus, Sabotage, iNDMx, Mango_Knife, MrBerrics
06-20-2014, 03:49 PM #2
Mango_Knife
In my man cave
Cool.

The following 3 users say thank you to Mango_Knife for this useful post:

ALI ALHILFI, Sabotage, iNDMx
06-24-2014, 09:06 PM #3
iNDMx
Do a barrel roll!
very nice ...
06-27-2014, 10:54 AM #4
Bank$
Keeper
Thanks for this, Sticky! Very helpful!
06-30-2014, 12:25 AM #5
Harry12345789
Former Writer
Awesome share, thanks for this Happy!

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo