Cubescript Text Display Support
#1
I was thinking about the recently included tutorial made by Gibstick and DES|Bukz, and I thought about how nice it would be to allow their text to be displayed in a fashion not unlike the "!TEST BUILD!" that one might see when testing SVN. I thought I would just transcribe their tutorial into C++, then I figured, why not just include some cubescript support? So I got to coding.
This is what I came up with (so far):
VARP(displayed_text_y, 0, 10, 2500);
VARP(displayed_text_x, 0, 10, 2500);
void display_cs_text ()
{
    draw_textf("%s", displayed_text_x, displayed_text_y, getalias("displayed_text"));
}
With display_cs_text hidden away in gl_drawhud.
This allows the user to change the text location, and what the text says. Now, I do see some problems with including this, with such a huge range of values for the location, but I figured I'd get that smoothed out once I finish it.
This is what I ended up with:
[Image: helloworld.jpg]

I was wondering what the devs thought of this (currently) 8 lines of C++ being include in AC? I am also wondering what other people think I can improve in these lines. I know the ranges aren't perfect, but that will come later.
Thanks given by:
#2
Wonderful! Colours work, right?
Thanks given by:
#3
That is what I'm going to do next time I work on it. I'm pretty sure I know how. I'm starting to think of limiting it to the right hand side of the screen only, this will make it so people dont decide to put a period in the middle of the screen when using the sniper. (One of the biggest problems with implementing it.
Thanks given by:
#4
Ah!
You didn't tell me you could change the text and its position!
Much cooler! :D
Thanks given by:
#5
Haha
This is a off shoot from my little hello world project that I was telling you about.
Thanks given by:
#6
Makeshift sniper crosshairs, I can see it already.
Thanks given by:
#7
Hence me limiting it to the right side of the screen. Left side would allow someone to use bunches of spaces to get over there, right side of the screen would only allow them to go off the screen with their text. There might be some other things I could use to prevent that, but as I said, I need to work on that aspect more.
Thanks given by:
#8
Or limit locations to a distance x above and below the height of the crosshair.
Thanks given by:
#9
I thought about that, except that the text might be able to extend all the way into the crosshair area. Because you only limit the starting point, not the ending point. Again, I need to look at draw_textf or just draw_text to really know what I'll do.
Thanks given by:
#10
I'd say most people would rather stick a dot to their screen instead of learning script commands ;)
Thanks given by:
#11
I'd rather learn to pwn with pistol. :-P
Thanks given by:
#12
(26 Nov 10, 03:10PM)tempest Wrote: I'd say most people would rather stick a dot to their screen instead of learning script commands ;)

we can manage to check text position.
Thanks given by:
#13
Before I got to far with limiting the text-able areas, I found that when I died, so did the text. I'm pretty sure I need to find a better place to execute the function. Yet I currently haven't found a better spot.
Thanks given by:
#14
Sounds like it's happening cos the game goes into spectator mode while dead; off the top of my head, the only UI element I can think of that's always available is the console output, so try putting it there.
Thanks given by:
#15
scores (if showscoresondeath is 1), radar, teamicon, stats (if stats > 0) also remain after death.
Thanks given by:
#16
I was thinking of putting it was in the console output, which makes some sense. I will do one test first which is replacing the !TEST VERSION! or whatever that says with my line of code, because I know that stays on (when uncommented) I do have it right under those lines of code though.
Thanks given by: