Cube2 Console Issues

Cube2 Console Issues

Postby ZeroKnight » 22 Jul 2011, 23:08

So, I've been trying to write a Compass extension, that adds useful phrases (with color) on a per-game mode basis. I have compasses for CTF, DTF, and Bomber Ball.
Logically, all of my code is correct, (except for the color codes, which is a separate issue with how say(team)command works) however, exec'ing my file returns an unnecessary "missing ]" error, and when adding an extra ] at the end, it works, but contradicts itself by throwing and "unexpected ]" error.
What's more baffling is that my code is formatted the same as Kitsune's Chat Color script, and even Red Eclipse's own "compass.cfg". Neither of those throw the "unexpected ]" error, and they're formatted the same way.
I'm running Windows, so at first it was formatted with CRLF line space format, so I thought that's what was bugging the console, but converting it to LF format didn't do squat.

Also, continuously baffling, I even typed it out in the console itself, using Ctrl+J (LF) as a line space, and it worked, even in the same format as my cfg.
Again... WHY?! (I only however, wrote only a bit of it, which only had a few compass entries) The main point of why I tried that was to see if it would still throw the "missing ]" error. Which it didn't.

Original
{l Code}: {l Select All Code}
newcompass CTF "textures/voices" [
    compass "Cover Me!" [sayteam " 2Cover Me!"]
    compass "Cover our Carrier!" [sayteam " 2Cover our Flag Carrier!"]
    compass "Kill the Carrier!" [sayteam " 3Kill the 2Flag Carrier 3so we can 0CAPTURE!"]
    compass "Stay in Groups!" [sayteam " 2Stay in groups!]
    compass "Capture the Flag!" [sayteam " 6Capture the Enemy Flag!"]
    compass "Pressure Them!" [sayteam " 3Pressure them! Attack harder!"]
    compass "Defense the Flag! [sayteam " 9Defend our Flag!"]
    compass "DTF" "X" [showcompass DTF]
]

newcompass DTF "textures/voices" [
    compass "Help Capture!" [sayteam " 3Help 0capture 3this Flag!"]
    compass "Help Defend!" [sayteam " 3Help 9defend 3this Flag!"]
    compass "Assault Harder!" [sayteam " 6Assault harder! 0Capture 6some Flags!"]
    compass "Defend Harder!" [sayteam " 9Defend harder! Protect our Flags!"]
    compass "Hold Their Flags!" [sayteam " 6Hold their flags! Don't let them recover!"]
    compass "Recover Our Flags!" [sayteam " 0Recover our Flags!"]
    compass "Bomber-Ball" "X" [showcompass Bomber-Ball]
]
   
newcompass Bomber-Ball "textures/voices" [
    compass "Cover Me!" [sayteam " 2Cover Me!"]
    compass "Cover our Bomber!" [sayteam " 2Cover our Bomber!"]
    compass "Kill the Bomber!" [sayteam " 3Kill the 2Enemy Bomber!"]
    compass "Stay in Groups!" [sayteam " 2Stay in Groups!]
    compass "Stay by the Bomb!" [sayteam " 6Hold ground by the Bomb! Don't let them touch it!"]
    compass "Defend our base!" [sayteam " 9Fall back and defend our base harder!"]
    compass "CTF" "X" [showcompass CTF]
]

bind X [showcompass CTF]


Kitsune got it to work by changing the order of my entries (with the extra ] mind you, that's the only way anything will advance) and everything works perfectly. However, WHY remains my question, and the changed order is not a favorable fix.

Working Revision
{l Code}: {l Select All Code}
newcompass CTF "textures/voices" [
compass "Cover Me!" [sayteam "2Cover Me!"]
    compass "Cover our Carrier!" [sayteam "2Cover our Flag Carrier!"]
    compass "Kill the Carrier!" [sayteam "3Kill the 2Flag Carrier 3so we can 0CAPTURE!"]
    compass "Capture the Flag!" [sayteam "6Capture the Enemy Flag!"]
    compass "Pressure Them!" [sayteam "3Pressure them! Attack harder!"]
    compass "Defense the Flag! [sayteam "9Defend our Flag!"]
    compass "DTF" "X" [showcompass DTF]
    compass "Stay in Groups!" [sayteam "2Stay in groups!]
]]
newcompass DTF "textures/voices" [
    compass "Help Capture!" [sayteam "3Help 0capture 3this Flag!"]
    compass "Help Defend!" [sayteam "3Help 9defend 3this Flag!"]
    compass "Assault Harder!" [sayteam "6Assault harder! 0Capture 6some Flags!"]
    compass "Defend Harder!" [sayteam "9Defend harder! Protect our Flags!"]
    compass "Hold Their Flags!" [sayteam "6Hold their flags! Don't let them recover!"]
    compass "Recover Our Flags!" [sayteam "0Recover our Flags!"]
    compass "Bomber-Ball" "X" [showcompass Bomber-Ball]
]
newcompass Bomber-Ball "textures/voices" [
    compass "Cover Me!" [sayteam "2Cover Me!"]
    compass "Cover our Bomber!" [sayteam "2Cover our Bomber!"]
    compass "Kill the Bomber!" [sayteam "3Kill the 2Enemy Bomber!"]
    compass "Stay by the Bomb!" [sayteam "6Hold ground by the Bomb! Don't let them touch it!"]
    compass "Defend our base!" [sayteam "9Fall back and defend our base harder!"]
    compass "CTF" "X" [showcompass CTF]
    compass "Stay in Groups!" [sayteam "2Stay in Groups!]
]]
bind X [showcompass CTF]


If we can get it to execute properly and in the right order, we can move on to fixing the color.
Last edited by ZeroKnight on 23 Jul 2011, 00:17, edited 2 times in total.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Cube2 Console Issues

Postby sireus » 23 Jul 2011, 10:56

"Stay in groups!" is missing the trailing quote, and so is "Defense the Flag!" (btw, it should be "Defend"). I recommend using a syntax highlighter, it enabled me to spot the error within a second.
Hirato has written a CubeScript one for KDE-based editors (here), but C or bash or something work quite well too.
sireus
 
Posts: 109
Joined: 24 May 2011, 20:10

Re: Cube2 Console Issues

Postby Kitsune » 23 Jul 2011, 11:00

Wow how could we not notice that? xD
User avatar
Kitsune
 
Posts: 174
Joined: 28 Apr 2011, 00:07
Location: Maridia

Re: Cube2 Console Issues

Postby ZeroKnight » 23 Jul 2011, 11:05

Oh my god, thank you! Haha! That's sooo cliche!
Looked over that code a million times looking for syntax errors, but never noticed it. Then as soon as I post it, someone spots it XD And yeah, I noticed that earlier, fixed it :P It's because I had a different idea for the string earlier, then changed it, but forgot about "Defense" ^^"
And I didn't even think of using C++ syntax highlighting, hehe. Was thinking too literal, but that's a good tip for spotting strings ^^
So cliche. Thanks man, that was bugging the hell out of me. You win an internet.

Kitsune {l Wrote}:Wow how could we not notice that? xD

XD I have no idea man. I'm just glad it works. Now to tackle the color problem. I'm gonna try using a similar method to what you did in your color chat script.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Cube2 Console Issues

Postby Kitsune » 23 Jul 2011, 18:32

I already tried, while we we're still on irc. i tried 4 method variants from my chatcolor.gui I used it in the mediaplayer mod for the easter egg and tried that way too, and it didn't work, it just adds the color code infront of it as part of the text, so it has something to do with "compass"
User avatar
Kitsune
 
Posts: 174
Joined: 28 Apr 2011, 00:07
Location: Maridia

Re: Cube2 Console Issues

Postby ZeroKnight » 27 Jul 2011, 22:49

I actually figured it out, man! ^_^ I got it the other day actually. I noticed in RE's own cfg files, they use a separate way to format text color, and it works even with the saycommand in scripts!
They use "^f<letter><text>" Where <letter> is the color code. It's actually way easier to remember, because ^fy = yellow, ^fr = red, ^fg = green, etc. etc.
I tried that and it works. Fixed up the syntax errors and my compasses fully function. Now I just need to create the GUI, and add a few other things.
I'll be collaborating with you more on some things when I'm back online
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Who is online

Users browsing this forum: No registered users and 1 guest