![]() |
Buttons - driving me crazy.
Any clue as to what would cause buttons I create to 'eat' the first click?
I have created click to cure buttons for my group. The initial click of every button does absolutely nothing. Subsequent single clicks will fire the cure as long as that person is in my group. It's not that the buttons have to be double-clicked each time, just the first time. I can post the XML if needed. At work right now and I thought it may be something obvious to a vet. Also, I have compared (even copied) the buttons of other UIs and cannot track this down. |
Attach your xml file or just post the script that you're using. It sounds like you're using the = style script. Some scripts have to use = and some don't. If you're using the = style script the first time it fires it creates a property for that object. That's why we often just double any script that uses =. If you don't want to do that just add the property to the object so it's already created and you won't need to double the script.
Hmm, if that doesn't make any sense I can post some examples. Since you're making click to cure buttons for a group window it's usually easiest to look at some examples to see how others have done it before. I have a Profit and Fetish folder in my UI folder to look at examples of different scripts. |
You were absolutely right about the = . That did it.
Thank you SO much! |
Quote:
I've run into the same issue as the OP here, except I'd prefer not to have to double my script as it sends a tell and that would make it so every click after the 1st sends 2 tells. |
You could either discard the = (easiest) or add the tell as a property to the button you use to send it, e.g. <Button OnPress="tell=text" tell="text" />
|
Quote:
I'd prefer not to do the latter as I don't want to be spamming people with double tells. Thanks in advance. I'm very new to this. :) Edit: Nevermind! I figured it out thanks to your suggestion. An example would be (from a raid window XML click-cast heart/shard mod FYI, credit goes to pretty much all of them as they all look very similar in the XML, though I've modified it quite a bit): Code:
<Button Location="0,0" Name="Button1" OnActivate=" |
Sorry, I've been working the last couple days so I haven't been on the forums.
Pretty much any command line script like "/tell player hello" or "/show_window MainHUD.Browser" can be used but without the "/" character. Some scripts will just work like <Button OnPress="tell player hello"/> Some scripts don't seem to work and require you to write <Button OnPress="show_window=MainHUD.Browser"/> This is the "= style notation." If you watch closely in the UIBuilder the very first time you press a button with the "= style notation" the press will just create a new property within that button so it looks like <Button OnPress="show_window=MainHUD.Browser" show_window="MainHUD.Browser"/> and the button doesn't actually do anything in the game until you press it a second time. To work around this complication UI modders started to just put the scripts in twice like <Button OnPress="show_window=MainHUD.Browser show_window=MainHUD.Browser"/> so the first script creates the property and the second script fires off the command. If you don't want to put the script in twice you can preemptively put the property into the button so it's already there like <Button OnPress="show_window=MainHUD.Browser" show_window="MainHUD.Browser"/> so then the button will work the first time you press it. I had to do this with my pet window so the button wouldn't spam your chat window twice. <Button Name="PetMelee" OnActivate="pet=melee" pet="melee"/> So, to summarize, some scripts just work and that's the first and easiest thing to try. Some require the "= style notation" which will require you to put the script in twice or preemptively add the property into the button. |
All / commands now work without the = notation, that thread is outdated. For example, pet melee or pet ranged work fine without the "=". The "=" notation can still useful for some situations where it makes nested code easier, however. And some game parameters can only be set via the "=", but I have not checked that in a long time, may no longer be necessary, either.
|
Ah I see, thanks for explaining the preemptive property thing.
I think I will stick with not using the = and having line breaks between commands as it is more elegant IMO. |
Quote:
I know certain commands still require the "=" like target_allow_pet_self_toggle. When I was putting together a player window with click-to-cure buttons I tried everything and ended up having to use: OnHoverIn="target_allow_pet_self_toggle=0 target_allow_pet_self_toggle=0" OnHoverOut="target_allow_pet_self_toggle=1 target_allow_pet_self_toggle=1" So that might be one of the game parameters you mentioned. From this thread way back in March: http://www.eq2interface.com/forums/s...ead.php?t=8073 |
I disagree, that's a command and works without the "=". I remember that thread, but I never added the "=" to my UI since it works fine without.
The only settings I remember having issues without "=" are some sound and graphics parameters. For example, if you look at _ProfitUI_InventoryColorSettings.txt in my UI, that one uses "=" notation because it would not work otherwise when I put it in. However, I have not touched that file in a year now, the "=" may no longer be necessary there, either. |
Quote:
|
| All times are GMT -5. The time now is 12:48 PM. |
vBulletin® - Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
© MMOUI