locprint and printing time

Post your scripting questions / solutions here

Moderator: Moderators

SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Code: Select all

display_pool:
    huddraw_font 50 facfont-20 
    huddraw_align 50 "right" "top" 
    huddraw_rect 50 -90 -50 100 100 
    huddraw_string 50 ("allies spawnpool = " + local.spawnpool_al)
    huddraw_color 50 0.0 0.0 0.0 
    huddraw_alpha 50 0.5 
    
    huddraw_font 51 facfont-20 
    huddraw_align 51 "right" "top" 
    huddraw_rect 51 -90 50 100 100 
    huddraw_string 51 ("axis spawnpool = " + local.spawnpool_ax)
    huddraw_color 51 1.0 0.0 0.0 
    huddraw_alpha 51 0.5 
    
    thread display_pool1
    end

display_pool1:
    
    huddraw_font 52 facfont-20 
    huddraw_align 52 "right" "top" 
    huddraw_rect 52 -90 -50 0 0 
    huddraw_string 52 ("allies spawnpool = " + local.spawnpool_al)
    huddraw_color 52 0.0 1.0 0.0 
    huddraw_alpha 52 0.5 
    
    huddraw_font 53 facfont-20 
    huddraw_align 53 "right" "top" 
    huddraw_rect 53 -90 50 100 100 
    huddraw_string 53 ("axis spawnpool = " + local.spawnpool_ax)
    huddraw_color 53 0.0 0.0 1.0 
    huddraw_alpha 53 0.5 
            
    end    
display_pool is exec in a while loop..
I don't get it to work, maybe I have to leave out the size:
huddraw_string <index> <string>
This sets the huddraw element to display a string instead of a shader graphic. The size
of the font can not be adjusted, but the color and alpha settings do affect the text.
The width and height parameters of huddraw_rect are only used for alignment centering,
Not for setting the size of the string.
But console didn't give me errors..so I'm a little confused, I also tried to wait some minutes ingame, to see if it's delayed but for nothing..
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

I always set the size to 100 100 (except with globalwidgets). You have aligned them right, horizontally. Try decreasing the X value to -200.

Here's an example where I used the right alignment:

Code: Select all

		huddraw_font 49 facfont-20
		huddraw_align 49 "right" "center"
		huddraw_rect 49 -200 20 100 100
		huddraw_color 49 1.0 1.0 1.0
		huddraw_alpha 49 0.9
		huddraw_string 49 "<HERR FLICK>"
However I honestly do not get your way of scripting. Why 2 threads? :? When the first executes the second, just make it one big thread with a loop because executing threads/scripts in a loop has a bigger strain on the engine since the game continuously creates and destroys scriptthreads.

One execution, one thread, one loop; increased efficiency, less strain.

Good luck with huddraw :) Once you get the hang of the rect (believe me, it can be a real pain and can cost a lot of precious time) you will be using huddraw a lot.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Well I need some more confidence with MOH scripting..I'va made 2 threads without thinking over it to look for a better way..really don't know why..sometomes I really do stupid/useless things! lol ..however huddraw is really intresting..even if I spent all yesterday night to understeand how to use it and still can't get it the way I want..I will continue testing the XY coords(that are killing me!)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Indeed, I've cursed the huddraw_rect many times before myself.
If you want I could make a tool, where you can change the huddraw in game and see instant changes.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

is it possible?! it would be a really great job man! PS: but If i'm not wrong..huddraw is a script data..and is not possible to load scripting lenguage ingame!...humm oooh maybe I 've understood how! :D ...with cvar that linked the hudraw X and Y..that's just a supposition!), however if you can do it I think it would be a useful yool for me and everyone who spend 3 hours to dotect a damn coord on the screen! :wink:
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Yes, it can be simple done with cvars...
btw theres a way to cast some script command from console on entity,,,
"script <entity> <command> <parms...>", for example "script player german" or "script *5 drive t24" etc... one note, it works only in sp, i mean bt sp,
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

It took me about 3 hours to complete the tool.
Since I have problems using filefront; here's the script to manage HUD elements in game on megaupload:

http://www.megaupload.com/?d=NRLGZOSH


Place in main/global/ and exec after waittill spawn. Use chud_help 1 in the console to go to the help section. Everything will be explained there. The script should be running when you see the "Example Text" displayed on the centre leftside of the screen.

Good luck!
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Very nice tool..but can't get the help section on:

http://www.box.net/shared/o3uvaepxbb
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

That's because developer is off. Turn it on by setting this in your config:

Code: Select all

set developer "1"
Developer is essential to modding, all errors will be printed in the console. And apparently, println doesn't work if developer is turned off.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

It was on, but it's set on the server link, maybe couse of that...I'm onna try to set it on in a lan game
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Code: Select all

        huddraw_font 50 facfont-20 
        huddraw_align 50 "left" "center" 
        huddraw_rect 50 15 310 150 150 
        huddraw_string 50 "allies spawnpool = "
        huddraw_color 50 0.2 0.2 1.0 
        huddraw_alpha 50 0.5 
        
        huddraw_font 51 facfont-20 
        huddraw_align 51 "left" "center"
        huddraw_rect 51 15 330 150 150 
        huddraw_string 51 "axis spawnpool = "
        huddraw_color 51 1.0 0.2 0.2 
        huddraw_alpha 51 0.5 

        huddraw_font 52 facfont-20 
        huddraw_align 52 "left" "center" 
        huddraw_rect 52 140 310 150 150 
        huddraw_string 52 local.string1
        huddraw_color 52 0.2 0.2 1.0 
        huddraw_alpha 52 0.5 
        
        huddraw_font 53 facfont-20 
        huddraw_align 53 "left" "center"
        huddraw_rect 53 132 330 150 150 
        huddraw_string 53 local.string2
        huddraw_color 53 1.0 0.2 0.2 
        huddraw_alpha 53 0.5 
that's good..it works..
my problem was that I didn't put it in a for...lol
also this will just return the the var, not the full string I want!
huddraw_font 50 facfont-20
huddraw_align 50 "right" "top"
huddraw_rect 50 -90 -50 100 100
huddraw_string 50 ("allies spawnpool = " + local.spawnpool_al)
huddraw_color 50 0.0 0.0 0.0
huddraw_alpha 50 0.5
HOWEVER, ty...problem solved! :wink:
Post Reply