Author Topic: Getting current paint number.  (Read 2269 times)

Is there a function to get the current paint colour?


I would do a .dump() on the client object.  The value is more than likely stored there.

Can't find anything in ski's and can't find anything in client's object.

Try the player object then.


I'm pretty sure either the client or player object keeps track of the tools you're using.  I don't know offhand if it lists the paintcan as well.  If so, try dumping that.  I'm at work right now so I don't have a good way to check.

Player Object keeps track of your tools but the only thing it says about the paintcan is when you have it mounted "currWeaponSlot" is -1.

Alright.  I'll take a look at it when I get back from work.

Thank you.

I've been doing a few things with trace and found:

scrollPaint(HowMuchToScrollBy); and shiftPaintColumn(HowManyColumns); but nothing to mention what colours.

I think I've got it,

%client.player.getMountedObject(0).getName();

It returns colorNumberSprayCanImage

number being the colour number.
Code: [Select]
%paintColour = %player.getMountedImage(0).getName(); %a = strReplace(%paintColour,"color",""); %paintNumber = strReplace(%a,"SprayCanImage","");
Seems to do it, probably a simpler way just I'm not that familiar with string functions.
« Last Edit: October 17, 2007, 12:11:26 PM by MrPickle »

Code: [Select]
package paintCheck
{
 function servercmdUseSprayCan(%cl,%num)
 {
  Parent::ServercmdUseSprayCan(%cl,%num);
  %cl.spray = %num;
 }
 function gameconnection::spawnplayer(%this,%a,%b,%c)
 {
  Parent::spawnplayer(%this,%a,%b,%c);
  %this.spray = "";
 }
};

Couldn't remember whether ::spawnPlayer took a transform, the extra arguments won't affect anything.

%client.spray will be "" if no spray can has been used/you just spawned or the number of the last used spray can.

@ MrPickle

I thought it could be done that way, although there should be a way to get the datablock and / or color value even if the paint can isn't mounted.

"Colour" is a terrible spelling of the word "color".

"Colour" is a British spelling of the American word "color".



The current spraycan is probably held client-side, so you'd have to use a method like Space Guy's.

British spelling / terrible spelling...same thing.
:cookieMonster:

Americans speak English so they should spell it colour.