| 10-16-2003, 01:32 PM | #196 | |
Quote:
|
| 10-23-2003, 07:23 PM | #197 |
Code:
function GetIssuedOrderItem takes nothing returns item
local item result
if (GetIssuedOrderId() >= 852008) and (GetIssuedOrderId() <= 852013) then
set result=UnitItemInSlot(GetTriggerUnit(), (GetIssuedOrderId()-852008))
endif
return(result)
endfunctionThis function works as an event response function for the Unit is issued an order events, in case the unit was ordered to use an item, this function will return the item. |
| 10-23-2003, 08:14 PM | #198 |
Great function Lord Vexorian, would you mind adding it to the Jass Vault yourself? That's the only way we can give you the credit for it atm. It should go into the category "Execution". |
| 10-23-2003, 08:21 PM | #199 |
I tried but I got strange errors, well I need to go out of this ciber cafe so I will try tomorrow Edit: Today is Yesterday's tomorrow, And I think I uploaded it, it looks like the comp I was using yesterday was wrong |
| 10-24-2003, 12:30 PM | #200 |
I was making a lot of updates on the site yesterday, so you probably tried viewing it while I was updating it. Btw, I don't know why I said that the category should exection, because it definately shouldn't (what was I thinking?), so I changed it to "Other". |
| 10-25-2003, 03:06 AM | #201 |
Heh :) I just have a small function request/challenge ;) I could do this myself, but i guess i'm lazy/busy. This is a thing i would have good use for in my map (and others too most likely), but as we're trying to get it out quickly, i'm not allowed to implement new stuff :P or else it'll never be done, so if someone does this for me, it will be in the release, if not :) i'll just do it later. But basicly, I would love if someone created a: function ColorFromPercent takes real *percentage, **string color_nr1, **string color_nr2 returns string *Can be a value between 0-1 (like 0.45) or a "precise" value between 0-100 (45.78) (and yes i know that one can enter 0.4578, but the latter is cooler :P basicly, doesn't matter the least. **I chose string, but you can chose whatever you like, i just chose string so one can fit the whole color-code on 1 value (f.ex. 00ffffdd). But it can just as well be 6 (or 8 if you take alphas) integer/real values...3 (4) for each color (r, g, b). And...as you perhaps are confuse what this function does, i'll explain. It basicly analizes the 2 colors, and returns a color, that is exactly (gradient'ly) 'percentage' between, so if you would give it yellow, and red, and you would give it a percentage of 0.50, it would return a color-code of exactly in between red and yellow. I would also expect this to be of quality and to be able to handle whatever colors, and whatever percentage (between it's min and max ofcourse) and that it would return "true" values (not just the same between 0.35 and 0.40). If you do not understand me, you can ask me for more details, but i don't really expect someone to take their time to do this for me, it's just something that might fit well in the database (which personally is a great idea). Thanks in advance Cubasis ps. i have some "more" functions for request that i might challenge someone with :). |
| 10-25-2003, 09:57 AM | #202 |
I'd prefer to call that function MixColors. It shouldn't be too hard to make |
| 10-25-2003, 07:57 PM | #203 |
Heh =) The name doesn't matter the least, i just wrote down the first thing i thought of, and it isn't even a legit function name (considering usual naming-procedures). And yeah, this is actually pretty easy. It just needs to first convert the different Hex values (or whatever input-type you're using) into a real number. Then find the differences between the different colors, multiply it with the percentage (or sumtin like that) and then convert it back. To explain the usability of this function, it can be used to display a colored Health-value to player. It can be used to do custom gradiented stuff at the spot and much more. F.ex. all kinds of text-sexyness. Cubasis |
| 10-26-2003, 06:56 AM | #204 |
hm, I have a color run string function in weu. It takes a string and to hex color values and then lets the color of the string run from the one color to the other |
| 10-26-2003, 03:48 PM | #205 |
Hey, KaTT I'd like to search functions by user rating So It would only return the excellent or outstanding functions |
| 10-26-2003, 04:52 PM | #206 |
Well pitzer, i just saw this yesterday in fact But it doesn't really help me. I'm not really looking for a gradient text, i'm looking for a color-coded text. F.ex. my main use for it, is to have it display hp-value in color, as when people see plain numbers they have to "read" it to understand it (plain white numbers in a row). I am trying to make it so they only need to glance in the direction to see it. This is also useful f.ex. if i wanna make a gradiently "blinking" text, like f.ex. from white to grey and back in a periodic trigger, just for fun actually :) but yeah... Cubasis |
| 10-26-2003, 05:16 PM | #207 |
Just wanted to point out that this function could be extended to suit your needs. I should however rewrite the Hex-Integer-Converter before. It's really complicated as it's now and there are easier ways of converting. |
| 10-27-2003, 12:13 AM | #208 |
It sounds to me like the function Cubasis wants would be part of a gradient text function. |
| 10-27-2003, 01:08 AM | #209 |
What do you think about this Hex to Dec function? I wrote it "from scratch" so it may not work =) And It can be really simplified for 2-digit hex numbers. I'm not sure about function name - Power(x,y) - please specify its name! Code:
// Uses global declared string array: udg_HNums // You should execute this function on map initialization: [color=coral] function HInit takes nothing returns nothing set udg_HNums[0] = "0" set udg_HNums[1] = "1" set udg_HNums[2] = "2" [/color] // 3,4,5,6,7,8 here [color=coral] set udg_HNums[9] = "9" set udg_HNums[10] = "A" set udg_HNums[11] = "B" set udg_HNums[12] = "C" set udg_HNums[13] = "D" set udg_HNums[14] = "E" set udg_HNums[15] = "F" endfunction [/color] [color=coral] function HSymbol takes string Str returns integer local integer i = 0 loop exitwhen (udg_HNums[i] == null) or (udg_HNums[i] == Str) set i = i + 1 endloop if udg_HNums[i] == null then return -1 else return i endif endfunction function HexToDec takes string Hex returns integer local integer i = 0 local integer Sum = 0 local integer LocalIndex = 0 local integer Size = 0 loop exitwhen SubString(Size,Size+1) == "" set Size = Size + 1 endloop loop set LocalIndex = HSymbol(SubString(Str,i,i+1)) exitwhen LocalIndex == -1 set Sum = Sum + LocalIndex * Power(16,Size - i - 1) set i = i + 1 endloop if SubString(Str, i, i+1) != "" then return 0 else return Sum endif endfunction [/color] Just call HexToDec("ABCD0") to get its decimal integer value. No overflow check =) |
| 10-27-2003, 05:15 AM | #210 |
I'd integrate HInt into the main function by setting a string variable to 0-F and using the index for the substring as its value. This is pretty clean but doesn't add the bloat of an additional function. |
