1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Scripting Help?

Discussion in 'Modding [KAG Classic]' started by Ulthuanelf, Jan 18, 2013.

  1. Ulthuanelf

    Ulthuanelf Shark Slayer

    Messages:
    68
    EDIT: My brother, Robinskie, didn't notice he was logged in as me with this as a result. Feel free to comment normally. :)

    Hello, I'm trying to create a mod for KAG. The mod uses .gm files for most of the time, and I'm pretty new to this GameMonkey Scripting. (I've done programming before, tho.)
    The idea is to make some kind of arena battle (human knight and archer versus zombies) with rounds.
    I'm trying to create a server using the ZA_autostart.gm file (that's how I named it), but it keeps crashing.
    The logs say: error (13) [ COMMANDS NEED A '\' or '/' PREFIX ] parse error, expecting `'{''

    Here's the code I'm using:
    Code:
    newWorld( "" );
    switchGameState(0);
     
        startServer();
     
        LoadRules("Rules/ZA/gamemode.cfg");
        LoadMapCycle( "Rules/ZA/mapcycle.cfg" );
        LoadMap( "" );
     
    serverMessage("Game starts in 30 seconds...");
     
    round = 1;
    while(true);
    {
    print(`Spawning skeletons`);
    serverMessage(`Spawning `+round*2+` skeletons!`);
    loop = 0;
    while(loop<=round*2);
    {
    loop = loop+1
    addBlob(`skeleton`, `Entities/Actors/Skeleton.cfg`,64 ,64,1); //Coordinates just for testing
    }
     
    print(`Spawning skeletons`);
    serverMessage(`Spawning `+round+` zombies!`);
    loop = 0;
    while(loop<=round*1);
    {
    loop = loop+1;
    addBlob(`zombie`, `Entities/Actors/Zombie.cfg`,64 ,64,1);
    }
    serverMessage(`New round in `+round*10+` seconds.`);
    sleep(round*10);
    round = round+1;
    }
    I'd be glad if I got this fixed and be able to continue modding. :)
     
  2. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    So basically I made this thread, and not Ulthuanelf. Sorry for the confusing stuff :(
     
  3. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    Good idea !But the problem of '{' come from to red cross:

    Where is the '{' ?

    (But I'm not sure)
     
  4. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    Why would I need one there?

    ALSO: 100th Post! PARTY! 25252525
     
  5. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    Because you have forgot the '{' here (red cross),no?
     
  6. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    If I count well, I don't see any problems with the {'s.
    I placed a newline there for extra readability. :)
    Empty lines are allowed in GM right? :huh?:
     
  7. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    I don't think
     
  8. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    Tried it without the blank line, same problem. :(
    BTW: While coding, sometimes I need to use `` and sometimes "", what is the difference and when do I need to use which one?
     
  9. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    The "" serves to indicate the folder of the fichier, example:
    And the `` serves to the rcon,example:
     
  10. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    Soo, serverMessage( `Game starts in 30 seconds... `);
    should be with "" ?
     
  11. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    No,you should be with `` ;)
     
  12. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    Okay. :D
    But it still crashes. D:
     
  13. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    oh... :(
     
  14. Robinskie

    Robinskie Drill Rusher

    Messages:
    124
    I found half of the solution (Thanks to looking at Starthos' DK Gamemode files) and I had to remove the ' ; ' after while(true).
    But now it's stuck on 'Loading Map...', I'll try to fix that tomorrow.
     
  15. Mildophin

    Mildophin Explorer Naturalist Donator

    Messages:
    71
    it's good for you :)