A player attacks another player for a damage random 1-200. I want a visual display of the damage to appear for both players to see. It seems unpractical to write out 200 "if" statements and change the damage icon for 200 different outcomes.
Problem is, I have no idea how to start it. I was thinking of just using the icon pictures for 1-9, then check the value through a certain procedure, and if it's a double digit, I can play two icons on screen and use pixel offset to move the double digit off to the side. Does this even make sense?
proc
damage_center(obj/o,dam) //o is the location of where the numbers are being displayed.
var/damage = num2text(dam)
var/location = o.loc
for(the first number in damage)
if(number==1)
new/obj/damage/one(location)
if(number==2)
new/obj/damage/one(location)
//etc... up to 9
for(the second number in damage)
if(number==1)
var/obj/q = new/obj/damage/one(location)
q.pixel_x += 15 //move it off to the side so it forms the full number
if(number==2)
new/obj/damage/one(location)
//etc... up to 9
EDIT: On a side note: when you move something using "loc" for example loc = usr.loc, does this call Move()? If not, how can I check to see when something in paticular's location is moved. The reason for this is I want to run a paticular procedure whenever something's location is changed through loc.
Use the forum search and resources search on this subject, it has been answered many times. Basically, you get a font as a DMI, meaning you've got a DMI file with icon states each containing a single character, then you use that file to draw the full words (or numbers).
Thankfully, Lummox JR made a library and a tool to make this easier: hub://LummoxJR.DMIFontsPlus
No, it doesn't, and in turn it doesn't invoke any of the other movement system procs, effectively making the game itself 'unaware' of that movement taking place. And that is exactly why doing so is bad practice and should be avoided in general, common cases (same thing for moving things by modifying their coordinate vars or putting them in some object's contents). Always use Move() or a similar solution* to move stuff (except in special cases).
*: Sometimes you will want a movement not to fail due to density or not to fail at all, in which case the original Move() is not suitable and you'll need to use your own function that still alerts the movement system properly to the move.
By the way, rereading Move()'s reference entry would've answered the basic question. It would still be pretty useful for you to do that now, though.
It's not possible in DM to automatically invoke a procedure when a variable changes (except the built-in vars that do so hardcodedly). However, you don't have to do that, and can get away without it just fine.
In this case, I'm not sure what entirely is the purpose of what you want to do, but it sounds like you can use Exited() for this. Again, just make sure you cleanse your project of any inappropriate direct-moving of movables (== modifying loc,x,y,z,contents).