dropdown bool

ItsColdItsCold Posts: 22Member
in GUI

hi, im trying to make some sort of document with optionbutton in it.
is there anyway, for example:

if i choose option A on dropdown 1, then dropdown 2 will provide option B, but if i choose option B on dropdown 1 instead, dropdown 2 will provide option C.

trying to add int value on each option doesnt seem to work

Comments

  • MegalomaniakMegalomaniak Posts: 1,275Admin
    edited May 7

    Create multiple variants of dropdown 2 and switch them according to selection in dropdown 1?

  • ItsColdItsCold Posts: 22Member

    @Megalomaniak said:
    Create multiple variants of dropdown 2 and switch them according to selection in dropdown 1?

    yes, for example if i want to make a gender lock job on an RPG,
    i tried it to get the id then disable those who arent meet the requirement.
    but i can't use the if inside on_item_selected(id).

  • MegalomaniakMegalomaniak Posts: 1,275Admin

    Care to post your script for an example so we can take a look?

  • ItsColdItsCold Posts: 22Member
    edited May 7

    was stuck here:

    extends Control
    
    export (NodePath) var dropdownrank_path
    onready var dropdownrank = get_node(dropdownrank_path)
    
    #rank array
    var rank_array = ["A", "B", "C", "D", "E"]
    
    func _ready():
        #connect drodown
        dropdownrank.connect("item_selected", self, "on_item_selected")
    
        #add rank array
        add_rank_items()
    
    func add_rank_items():
        for item in rank_array:
            dropdownrank.add_item("Rank " + item)
    
    func on_item_selected(ID):
        #print(str(dropdownrank.get_item_text(1))) 
        if on_item_selected((1):
            get_item_
    

    someone told me(he's joking but viable i think) that i can instead make the dropdown myself. basically bunch of nodes with label, add variable for each option then set it to true when clicked/called

  • MegalomaniakMegalomaniak Posts: 1,275Admin

    Yes, basically construct your own with a basic state machine to track and switch the item visibility. That is certainly one way to go. The way I have gone in the past.

  • ItsColdItsCold Posts: 22Member

    @Megalomaniak said:
    Yes, basically construct your own with a basic state machine to track and switch the item visibility. That is certainly one way to go. The way I have gone in the past.

    i'd try that, as long as it works =)
    big love sir :3

Sign In or Register to comment.