Dynamic Rcon Menu

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
AOD KillerDude
Private
Posts: 2
Joined: Thu Nov 30, 2006 10:20 am

Dynamic Rcon Menu

Post by AOD KillerDude »

Is there a way to initialize a label resource with a local variable? This URC is an rcon menu that is map independent, so a script file would not already be initialized with a local variable, and I don't know if you can start a thread from within a URC.

This is what I want to do, but thats not happening: :cry:

Code: Select all

menu "testmenu" 800 595 NONE 1
fgcolor 1.00 1.00 1.00 0.00
bgcolor 0.00 0.00 0.00 0.00
align center

local.string = "something"

resource
Label
{
title local.string
name "Default"
rect 506 34 120 21
fgcolor 0.00 0.00 0.00 1.00
bgcolor 0.82 0.82 0.79 1.00
borderstyle "3D_BORDER"
}

Any ideas?
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Just link it to a cvar then set the cvar

resource
Label
{
name "Default"
rect 506 34 120 21
fgcolor 0.00 0.00 0.00 1.00
bgcolor 0.82 0.82 0.79 1.00
borderstyle "3D_BORDER"
linkcvar "label_text"
}

Then type into the console

set label_text "my text"

If a client sets a cvar that cvar will be set on the client only . If the server needs to set a cvar on the client then you can use

$player stufftext "set label_text " + "my text"

that should work but you may have to loop through each player . Depends on what you need it for too you can maybe use an field .
Image
Post Reply