ID:178806
 
1st I'd like to know if I can use the ColorSwap proc instead of drawing 95761643857543790 times the same icon but with different colors.

To be more specific:
If I use SwapColor, will the other players using the same icon file get thier colors changed too? and are these new colors permanent or returns to icon's initial colors once the program stops?

I'd also need too know how I can kinda force the player to input a number (rather than text) I know it is possible, but really I have no clue. Oh can I set the min and max of that number too?
Sabertooth wrote:
1st I'd like to know if I can use the ColorSwap proc instead of drawing 95761643857543790 times the same icon but with different colors.

Typically this could be done quicker by doing drawing first, caching, and then changing the colors of various copies.

To be more specific:
If I use SwapColor, will the other players using the same icon file get thier colors changed too? and are these new colors permanent or returns to icon's initial colors once the program stops?

Anyone using the same datum should experience those changes, but the datum is converted to a file format when it's assigned to an atom or returned from fcopy_rsc(). The file-type object should be separate from the datum, so changing the /icon datum after that shouldn't affect other objects.

For example:
var/icon/ic=DrawSomething()  // my drawing proc
themob.icon=ic // changes /icon to a file
var/ic2=ic // doesn't change anything
ic2.Blend(rgb(0,255,0),ICON_MULTIPLY)
theobj.greenicon=fcopy_rsc(ic2) // also changes /icon to a file

I'd also need too know how I can kinda force the player to input a number (rather than text) I know it is possible, but really I have no clue. Oh can I set the min and max of that number too?

I don't think you can set min/max, but to get a number you'd use this:
var/result = input(...) as num

Lummox JR
if u want to know what will happen when u use a proc, test it out.

and about the input, yes u can force a number input, just add as num at the end. example:

var/lv=input("What level do you want to start at?")as num
if(lv>=50)lv=1;usr<<"i dont think so"
if(lv<=5)lv=100;usr<<"just for that ill give you a few extra"

that example makes the player input a number, and if the number is greater than (or equal) 50 it goes down to 1, if it is less than 5 it goes up to 100. of course u can change those numbers. if u want it instead to keep asking until they give a number in the range then u could do this:

mpb/proc/boxinput()
var/boxes=input("how many boxes do you want to start with? (please put a number from 10-20)")as num
if(boxes>=21)
usr<<"i said 10-20 try again, and less this time"
src.boxinput
else if(boxes<=9)
usr<<"i said 10-20 try again, and more this time"
src.boxinpute
else usr<<"you now have [boxes] boxes, use them wisely"
In response to Lummox JR
That should help a lot, Thanks :)
In response to Lummox JR
I don't think you can set min/max, but to get a number you'd use this:
var/result = input(...) as num


If I recall right, there *is* an optional 'in' argument to as num.

var/result = input() as num in 1 to 100

I'm not sure if that only works for variables intended to be edited in the instance editor of the mapper, though. And I'm not even sure if it works for the instance editor either, because though it was said it'll work that way, I've never tested it. ;-)
In response to Spuzzum
Spuzzum wrote:
If I recall right, there *is* an optional 'in' argument to as num.

var/result = input() as num in 1 to 100

Oooh. Now that could be interesting. I'll have to try it out sometime.

Lummox JR