Post: Custom value input - No setText
01-03-2012, 01:41 PM #1
d7w7z
Bounty hunter
(adsbygoogle = window.adsbygoogle || []).push({}); This is my copy of the old mw2 patches that allowed you to pick a custom value for a setting. It uses printlnBold or else it would have to use 10 setText strings to work(0 1 2 3 4 5 6 7 8 9).

If you don't know what this is go to around the 45 second mark in the video. This is what the idea was based off. Mine only uses numbers atm, might add support for characters + numbers.



    
CreateSlider(min,max,def,c1,c2,f) {
self endon("EndSlider");
self.slidec=0; self.skid=[];
for(i=0;i < max.size;i++){if(isD(def[i])) { self.skid[i]=def[i]; } else { self.skid[i]=min[i]; } }
t = SliderPrint(self.skid, c1, c2, false);
self iPrintlnBold(t);
for(;Winky Winky {
self waittill("moveslidemenu", D);
switch(D) {
case "U": self.skid[self.slidec]--; break; case "D": self.skid[self.slidec]++; break;
case "L": self.slidec--; break; case "R": self.slidec++; break;
default: self thread [[f]](SlideReturn()); self notify("EndSlider"); }
self.slidec = SlideVarCheck(self.slidec, min, max);
self iPrintln(SliderPrint(self.skid, c1, c2));
} }

SlideVarCheck(c, min, max) {
s=self.skid[c];
if(c<0) { c=self.skid.size-1; } else if(c>self.skid.size-1) { c=0; }
if(s < min[c]) { s=max[c]; } else if(s > max[c]) { s=0; }
self.skid[c]=s;
return c;
}
SlideReturn() {
t=0;f=0;s=self.skid.size-1;
for(i=0;i<s+1;i++) {
f=self.skid[i];
for(c=0;c<s-i;c++) { f *= 10; }
t+=f; }
return t;
}
SliderPrint(a,hc,uc) {
t=""; c=undefined;
for(i=0;i<a.size;i++) {
if(i==self.slidec) { c=hc; } else { c=uc; }
t+="^" + c + a[i]; }
return t;
}

isD(var) { return isDefined(var); }


The input must be arrays with one number per array. I don't know how to split an int into an array(array has to use ints, NOT strings) but if somelse does, let me know Smile

Example + How to use:
    
SliderTest() {
l=[];d=[];h=[];
l[0]=[B]0[/B]; d[0]=[B]1[/B]; h[0]=[B]9[/B];
l[1]=[B]0[/B]; d[1]=[B]3[/B]; h[1]=[B]9[/B];
l[2]=[B]0[/B]; d[2]=[B]3[/B]; h[2]=[B]9[/B];
l[3]=[B]0[/B]; d[3]=[B]7[/B]; h[3]=[B]9[/B];

//0000 - Min value
//1337 - Starting value
//9999 - Max value

[B]self CreateSlider(l, h, d, 1, 7, ::SetGravity); [/B]
[B]//CreateSlider(min value array, max value array, starting value array - can be undefined, highlighted colour, unhighlighted colour, function)[/B]
}


SetGravity([B]v[/B]) { //Once the number is selected, it sents it as an input to the function, use it to set the value.
self setClientDvar("g_gravity", [B]v[/B]);
self iPrintln("Gravity Set To " + [B]v[/B]);
}



Use these notifys to change the value of the numbers/move left and right.
    
self notify("moveslidemenu", "U"); //Reduce current number
self notify("moveslidemenu", "D"); //Increase current number
self notify("moveslidemenu", "L"); //Move to the number on the left
self notify("moveslidemenu", "R"); //Move to the number on the right
self notify("moveslidemenu", "Select"); //Finish picking value and do function
(adsbygoogle = window.adsbygoogle || []).push({});

The following 2 users say thank you to d7w7z for this useful post:

247Yamato, x_DaftVader_x
01-03-2012, 04:56 PM #2
Originally posted by d7w7z View Post
This is my copy of the old mw2 patches that allowed you to pick a custom value for a setting. It uses printlnBold or else it would have to use 10 setText strings to work(0 1 2 3 4 5 6 7 8 9).

I can't make a video but it was the one where it had X amount of numbers that you could increase or decrease by hitting up/down.

0 0 0 0
*presses up*
1 0 0 0
*presses right*
1 0 0 0

    
CreateSlider(min,max,def,c1,c2,f) {
self endon("EndSlider");
self.slidec=0; self.skid=[];
for(i=0;i < max.size;i++){if(isD(def[i])) { self.skid[i]=def[i]; } else { self.skid[i]=min[i]; } }
t = SliderPrint(self.skid, c1, c2, false);
self iPrintlnBold(t);
for(;Winky Winky {
self waittill("moveslidemenu", D);
switch(D) {
case "U": self.skid[self.slidec]--; break; case "D": self.skid[self.slidec]++; break;
case "L": self.slidec--; break; case "R": self.slidec++; break;
default: self thread [[f]](SlideReturn()); self notify("EndSlider"); }
self.slidec = SlideVarCheck(self.slidec, min, max);
self iPrintln(SliderPrint(self.skid, c1, c2));
} }

SlideVarCheck(c, min, max) {
s=self.skid[c];
if(c<0) { c=self.skid.size-1; } else if(c>self.skid.size-1) { c=0; }
if(s < min[c]) { s=max[c]; } else if(s > max[c]) { s=0; }
self.skid[c]=s;
return c;
}
SlideReturn() {
t=0;f=0;s=self.skid.size-1;
for(i=0;i<s+1;i++) {
f=self.skid[i];
for(c=0;c<s-i;c++) { f *= 10; }
t+=f; }
return t;
}
SliderPrint(a,hc,uc) {
t=""; c=undefined;
for(i=0;i<a.size;i++) {
if(i==self.slidec) { c=hc; } else { c=uc; }
t+="^" + c + a[i]; }
return t;
}

isD(var) { return isDefined(var); }


The input must be arrays with one number per array. I don't know how to split an int into an array(array has to use ints, NOT strings) but if somelse does, let me know Smile

Example + How to use:
    
SliderTest() {
l=[];d=[];h=[];
l[0]=[B]0[/B]; d[0]=[B]1[/B]; h[0]=[B]9[/B];
l[1]=[B]0[/B]; d[1]=[B]3[/B]; h[1]=[B]9[/B];
l[2]=[B]0[/B]; d[2]=[B]3[/B]; h[2]=[B]9[/B];
l[3]=[B]0[/B]; d[3]=[B]7[/B]; h[3]=[B]9[/B];

//0000 - Min value
//1337 - Starting value
//9999 - Max value

[B]self CreateSlider(l, h, d, 1, 7, ::SetGravity); [/B]
[B]//CreateSlider(min value array, max value array, starting value array - can be undefined, highlighted colour, unhighlighted colour, function)[/B]
}


SetGravity([B]v[/B]) { //Once the number is selected, it sents it as an input to the function, use it to set the value.
self setClientDvar("g_gravity", [B]v[/B]);
self iPrintln("Gravity Set To " + [B]v[/B]);
}



Use these notifys to change the value of the numbers/move left and right.
    
self notify("moveslidemenu", "U"); //Reduce current number
self notify("moveslidemenu", "D"); //Increase current number
self notify("moveslidemenu", "L"); //Move to the number on the left
self notify("moveslidemenu", "R"); //Move to the number on the right
self notify("moveslidemenu", "Select"); //Finish picking value and do function


I didn't understand a word you just said but , as usual, top stuff.. Happy
01-03-2012, 05:00 PM #3
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by x. View Post
I didn't understand a word you just said but , as usual, top stuff.. Happy


Isn't there a way to show just numbers without using setText();? I believe it's called setValue(); i dunno though i may be wrong you've been coding longer than me so you can tell me if im wrong or not :p,
01-03-2012, 05:03 PM #4
Originally posted by IVI40A3Fusionz View Post
Isn't there a way to show just numbers without using setText();? I believe it's called setValue(); i dunno though i may be wrong you've been coding longer than me so you can tell me if im wrong or not :p,


I dunno, if it hasn't got dancing sex dolls in it I'm not interested :fyea:

The following user thanked x_DaftVader_x for this useful post:

Blackstorm
01-03-2012, 05:07 PM #5
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by x. View Post
I dunno, if it hasn't got dancing sex dolls in it I'm not interested :fyea:


If only CoD4 had dancing sex dolls :(, they were the best thing about MW2 Modding.
01-03-2012, 06:07 PM #6
Blackstorm
Veni. Vidi. Vici.
Originally posted by x. View Post
I dunno, if it hasn't got dancing sex dolls in it I'm not interested :fyea:


Lmao! You just made my day! xD

---------- Post added at 11:07 AM ---------- Previous post was at 10:20 AM ----------

Originally posted by IVI40A3Fusionz View Post
If only CoD4 had dancing sex dolls :(, they were the best thing about MW2 Modding.



Why are we on on Cod4 again?

The following user thanked Blackstorm for this useful post:

x_DaftVader_x
01-03-2012, 06:15 PM #7
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by Blackstorm View Post
Lmao! You just made my day! xD

---------- Post added at 11:07 AM ---------- Previous post was at 10:20 AM ----------




Why are we on on Cod4 again?


"Why are we on on Cod4 again?" huh? That makes no sense Happy.
01-03-2012, 06:35 PM #8
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by reScript
No no it makes a lot lot of sense! :carling:


Explain? :confused:
01-03-2012, 06:47 PM #9
Karoolus
I'm the W@W Menu Guy !
looks good Smile

although i don't like the iPrintlnBold..
wouldn't it be possible to use either "setcursorhint" or "sethintstring" ? i don't think they'll overflow, so should work, no ? Smile
01-03-2012, 07:37 PM #10
d7w7z
Bounty hunter
Originally posted by x. View Post
I didn't understand a word you just said but , as usual, top stuff.. Happy


about 1:23 it what Im talking about, I made a copy of it with printlnBold instead of setText

---------- Post added at 07:37 PM ---------- Previous post was at 07:31 PM ----------

Originally posted by Karoolus View Post
looks good Smile

although i don't like the iPrintlnBold..
wouldn't it be possible to use either "setcursorhint" or "sethintstring" ? i don't think they'll overflow, so should work, no ? Smile


Anything works fine, just make sure the method you use works with ^X colours. If it doesn't you will have to change SliderPrint() a little to return a string that works for you.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo