These are chat archives for ikkentim/SampSharp

14th
Dec 2016
Michael Kilpatrick
@NewbProgramming
Dec 14 2016 16:57
Turn the value from original range, and scale it to the value of another range.
Say I have a Slider, only takes 1 - 100, I slide it to 55, but I want it to do an Red value between 1 - 255, should return somewhere around 110.
Like this: YT watch?v=nicMAoW6u1g
donshius
@donshius
Dec 14 2016 18:35
@NewbProgramming i rewritten the sscanf function as an extension of string and made it simpler. I used an array of objects as it is faster. http://pastebin.com/sdDgMQrZ
the Player.get function is here: http://pastebin.com/FCEsqnQb
Usage: inputString.sscanf("u", out object[] parameters); ((Player)parameters[ 0 ]).SendClientMessage
Michael Kilpatrick
@NewbProgramming
Dec 14 2016 18:36
You're awesome ;)
donshius
@donshius
Dec 14 2016 18:36
you too, thanks for the command processing stuff
Michael Kilpatrick
@NewbProgramming
Dec 14 2016 18:37
Ooo the TryParse will not throw an exception if it failed though.
Tim Potze
@ikkentim
Dec 14 2016 18:37
@NewbProgramming (int)((float)(in - inmin)/(inmax-inmin)*(outmax-outmin)+outmin)
donshius
@donshius
Dec 14 2016 18:38
yeah, it just returns a bool which i think is more applicable for this situation
Michael Kilpatrick
@NewbProgramming
Dec 14 2016 18:41
@ikkentim You fixed it, thank you.
image.png
@donshius
I see that now, alright, learn something new everyday ^.^