Raised This Month: $ Target: $400
 0% 

Compile Error/Code Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer12201
Senior Member
Join Date: Dec 2007
Old 07-27-2011 , 05:45   Compile Error/Code Help
Reply With Quote #1

Code:
//// pokerank.sma
// C:\Documents and Settings\owner\Desktop\Servers\Compiler\scripting\poker
ank.sma(125) : error 014: invalid statement; not in switch
// C:\Documents and Settings\owner\Desktop\Servers\Compiler\scripting\poker
ank.sma(125) : warning 215: expression has no effect
// C:\Documents and Settings\owner\Desktop\Servers\Compiler\scripting\poker
ank.sma(125) : error 001: expected token: ";", but found ":"
// C:\Documents and Settings\owner\Desktop\Servers\Compiler\scripting\poker
ank.sma(125) : error 029: invalid expression, assumed zero
// C:\Documents and Settings\owner\Desktop\Servers\Compiler\scripting\poker
ank.sma(125) : fatal error 107: too many error messages on one line
I have spent hours searching through line 125 and all the lines above it to find my error. I would appreciate any help somebody can provide because I'm either too tired to find my mistake or just don't know how to find it. Below is the code down to line 126.

http://pastebin.com/YG5L2sdH
__________________
Killer12201 is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-27-2011 , 05:51   Re: Compile Error/Code Help
Reply With Quote #2

Code:
switch(menuselection[id])         {                 case MENU_MAIN:                 {                         case 0: pokerank1(id);                         case 1: pokerank2(id);                         case 2: pokerank3(id);                         case 3: pokerank4(id);
Could you explain what are you exactly doing here? If the menuselection[ id ] is MENU_MAIN( a constant ), how could it be 0, 1, 2, 3 as well? Just that your switch is totally wrong for the syntax it is not really logical at all either.
SnoW is offline
Send a message via MSN to SnoW
Killer12201
Senior Member
Join Date: Dec 2007
Old 07-27-2011 , 06:06   Re: Compile Error/Code Help
Reply With Quote #3

So what should I change it too? I looked in the BF2 menu section at that point to get help with menu's with sub sections. I'm not very good with menu's and got really confused on that part of it.

Edit: That part was supposed to do with this part. The cases were supposed to be the menu items but I'm assuming I did that wrong.

Code:
public pokemenu(id)
{
    new menu = menu_create("\rPoke Rank \wMenu", "menu_handler");
    
    menu_additem(menu, "\r25k Poke Rank \wMenu", "0", 0);
    menu_additem(menu, "\r50k Poke Rank \wMenu", "1", 0);
    menu_additem(menu, "\r75k Poke Rank \wMenu", "2", 0);
    menu_additem(menu, "\r100k Poke Rank \wMenu", "3", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    
    menuselection[id]=MENU_MAIN
    
    menu_display(id, menu, 0);
    
    return PLUGIN_CONTINUE;
}
__________________

Last edited by Killer12201; 07-27-2011 at 06:09.
Killer12201 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-27-2011 , 07:01   Re: Compile Error/Code Help
Reply With Quote #4

You need to use one switch for each set of cases, like this:

PHP Code:
    switch(menuselection[id])
    {
        case 
MENU_MAIN:
        {
            switch(
key)
            {
                case 
0pokerank1(id);
                case 
1pokerank2(id);
                case 
2pokerank3(id);
                case 
3pokerank4(id);
            }
        }
        case 
MENU_POKE1:
        {
            switch(
key)
            {
                case 
0// function
                
case 1// function2
                // ...
            
}
        }
        
// ...
    

__________________

Last edited by fysiks; 07-27-2011 at 07:03.
fysiks is offline
Killer12201
Senior Member
Join Date: Dec 2007
Old 07-27-2011 , 10:00   Re: Compile Error/Code Help
Reply With Quote #5

Will that fix my error? I understand what your saying but that is after the lines that my error is in. I still can't figure out what is going on
__________________
Killer12201 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-27-2011 , 17:43   Re: Compile Error/Code Help
Reply With Quote #6

Quote:
Originally Posted by Killer12201 View Post
Will that fix my error? I understand what your saying but that is after the lines that my error is in. I still can't figure out what is going on
My post will solve your "not in switch" error. The other are likely trivial.

If you want further help, paste the whole code.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 00:54.


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