![]() |
fire two action on onshow
Hi.
I've spent a couple of hours searching but i cant wrap my head around a little issue i'm having. Is it possible to fire two actions on an event? When i open a window (onshow) i want the ui to automagicly press two buttons (for two different calculations). Pseudo code: OnShow=Button1.press=true Button2.press=true or something like that... Is it possible? What i'm trying to do: I have in my inventory window some basic stats, like resists and defensive stats. I have one button that calculates average resists and want to add another button in the same window that calculates avoidance. I managed to figure out how to do average resists by stealing drumstix awesome sollution (thanks man ;)) but i want to do the same thing with another value... in the same window... It seems like such a simple problem but i cant figure it out :( |
You can indeed fire off several commands. It's usually easiest to just hit enter down to a new line, but technically you can separate by a space.
However, note that while the engine reads from top to bottom, it reads commands from right to left. In the UIBuilder, OnShow= Code:
Button1.press=true |
oh... :o
I almost wish it was horribly complicated then i wouldnt feel so stupid right now :p Thank you Drumstix :) |
Fireing off two actions worked just fine... but i ran headfirst into a massive brickwall with the next step of my master plan.
I am trying to calculate the avoidance of a character. If you hover over the Avoidance stat in the persona window you get a tooltip with your avoidance. It also shows your base, block and parry values. You can get base avoidance, block and parry through gamedata, however it returns the data as a percent value that i havent found a way to do arithmetics on. The math behind it is as follows (found the calculation on the official forums, took me a while to make a formula of it. Code:
Avoidance = x |
So you're getting something like 12.3% and want just the number?
int(P) will do *something* close to what you want. It'll either spit out 12 as an integer casting should, but I have a feeling it will give you 123. As in it just throws out all the non-digit characters. You can just divide that by 10 afterwards. You're probably going to have fun splitting that formula apart as well. You can only do one simple calculation per line. |
int(p) worked partly... it cut the % but it also cut .7 out of my 20.7% parry :(
float(p) gave me nothing... Splitting the formula into different lines actually makes it alot easier when it comes to the math :D The formula in plain english is; say you have 20% parry, 40% block and 10% dodge. Your actual avoidance is as follows: 20% of incoming blows are parried. .4*80%= 32% of incoming blows are blocked .1*48%= 4.8% of incoming blows are dodged Total avoidance: 56.8% |
See what happens if you add another decimal to it...
So the end result is like 12.3%.45. It'll either search forwards or backwards... I'd hate to assume which. |
Seems like i'm beating a dead horse :(
http://www.eq2interface.com/forums/s...ad.php?t=11356 Every time i do a type conversion to int it cuts the decimals and if i don't do a conversion to int i can't do any arithmetics :mad: Thanks for all the help though, appreciate it. DD for the avoidance is on the wishlist but nothing has happend in the past two years... |
| All times are GMT -5. The time now is 08:22 AM. |
vBulletin® - Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
© MMOUI