Jump to content

Max string length in if\endif block.


TommInfinite

Recommended Posts

Hey everyone.

 

I noticed long time ago that if you execute this code script will stop

if eval sv_temp == "StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item"
endif

It happens because string on the right side is too long. There's a workaround (see below). But is there another way I don't know of?

let sv_temp2 := "StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item"

if eval sv_temp == sv_temp2
endif
Edited by TommInfinite
Link to comment
Share on other sites

Odd, the string size looks perfectly ok to me.

 

If it's in a CO block, try using parentheses : if eval (sv_temp == "thestring")

or reverse the order: if eval "thestring" == sv_temp

or both.

 

(edit)

If that doesn't solve anything, you may have to use sv_compare.

Edited by DoctaSax
Link to comment
Share on other sites

    if eval ($GetActiveUIComponentFullName == "StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item")
    if eval ("StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item" == $GetActiveUIComponentFullName)
    if eval (sv_Compare "StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item", sv_temp) == 0 ; sv_temp is GetActiveUIComponentFullName

I tried these and they still broke the script. Have you never encountered that?

Edited by TommInfinite
Link to comment
Share on other sites

Maybe it's one of those "Only enplczru" kind of bugs?

 

Comparing string to a string is working fine. I don't like the idea of declaring string vars each time function checks for something. I also don't like the idea of keeping string variables in .nvse cosave. Maybe I'll use ModLocalData.

Link to comment
Share on other sites

I ended up using this code and it works. I think it's less CPU intensive than setting strings every time function is called.

	SetModLocalData "UINameTemp01" "StartMenu/NOGLOW_BRANCH/options_container/lb_meter_template_item" ; on game restart
    let sv_temp := GetActiveUIComponentFullName

    if eval (sv_temp == GetModLocalData "UINameTemp01")

    endif
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...