Author |
Topic: Menu response and dvar values |
Phl3x_ |
General Member Since: Jun 4, 2011 Posts: 19 Last: Jun 14, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Monday, Aug. 8, 2011 11:35 am |
|
Hello,
I made a small menu which, when it opens, I want it to send a dvar value to the script. I tried:
Code: onOpen
{
scriptMenuResponse dvarString( com_maxfps );
close fps;
}
But I had no luck. I even tried using "#define FPS dvarString( com_maxfps );" but I still got the same result. The response was simply the name of the function 'dvarString'.
I'd appreciate any help,
thanks |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
Phl3x_ |
General Member Since: Jun 4, 2011 Posts: 19 Last: Jun 14, 2012 [view latest posts] |
|
|
Category: CoD4 Scripting Posted: Tuesday, Aug. 9, 2011 05:59 am |
|
Ah ok, thanks for the reply.
Is there any way to use 'if' statements in menu scripting? I know you can in black ops, but I don't know about cod4. I just want something like:
Code: if( dvarInt( com_maxfps ) > 250 )
{
scriptMenuResponse "fps_too_high";
}
Thanks |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
|
Category: CoD4 Scripting Posted: Tuesday, Aug. 9, 2011 09:22 am |
|
IzNoGoD writes...Quote: It is not possible to get clientside cvar/dvars
http://www.itsmods.com/forum/Thread-getting-a-clientdvar.html
I have not tried this but someone made a tutorial about getting clientside dvars. It is for blackops but it looks like it would work for cod4 and others. |
|
|
|
Phl3x_ |
General Member Since: Jun 4, 2011 Posts: 19 Last: Jun 14, 2012 [view latest posts] |
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
Category: CoD4 Scripting Posted: Tuesday, Aug. 9, 2011 12:40 pm |
|
you can do more with dvar's on a menu-file
1st like iznogod showed (it will show the string if the dvar is "1" ( you can use showDvar & hideDvar ) )
Code: itemDef
{
name "login"
visible 1
rect 0 0 95 24
forecolor .96 .66 .04 .9
type ITEM_TYPE_BUTTON
text "@ZOM_UI_LOGIN_CONTINUE"
textfont UI_FONT_NORMAL
textscale .5
textaligny 20
dvartest "ui_login_status"
showDvar
{
"0";
"1";
}
}
2nd show the text what is in the dvar (instead of "text" use "dvar" to show it in the menu)
Code: itemDef
{
name "login_password"
visible 1
rect 110 20 180 24
origin ORIGIN_PANEL
type ITEM_TYPE_BUTTON
dvar "ui_login_password"
textfont UI_FONT_NORMAL
textscale .35
textaligny 20
textstyle ITEM_TEXTSTYLE_SHADOWED
}
3rd multi menu (it prints you the text and next to the text the string depending on the dvar)
Code: itemDef
{
name "login_status"
visible 1
rect 0 0 128 24
origin ORIGIN_LOGIN_STATUS
forecolor GLOBAL_UNFOCUSED_COLOR
type ITEM_TYPE_MULTI
text "@ZOM_UI_LOGIN_STATUS"
textfont UI_FONT_NORMAL
textscale GLOBAL_TEXT_SIZE
textstyle ITEM_TEXTSTYLE_SHADOWED
textalign ITEM_ALIGN_RIGHT
textaligny 20
decoration
dvar "ui_login_status"
dvarFloatList
{
"@ZOM_UI_LOGIN_LOGGED_IN" 0
"@ZOM_UI_LOGIN_LOGGED_IN_REGISTERED" 1
"@ZOM_UI_LOGIN_NOT_LOGGED_IN" 2
"@ZOM_UI_LOGIN_NOT_LOGGED_IN_GUID" 3
"@ZOM_UI_LOGIN_NOT_LOGGED_IN_USERNAME" 4
"@ZOM_UI_LOGIN_NOT_LOGGED_IN_PASSWORD" 5
"@ZOM_UI_LOGIN_NOT_LOGGED_IN_REGISTER" 6
}
}
(the multimenu does only work with dvarFLOATlist, INT, BOOL, STRING isnt supported on cod2, might be on cod4) |
|
|
|
Phl3x_ |
General Member Since: Jun 4, 2011 Posts: 19 Last: Jun 14, 2012 [view latest posts] |
|
|
|
serthy |
General Member Since: Sep 8, 2010 Posts: 482 Last: Jun 28, 2013 [view latest posts] |
|
|
|
|