Thank you both for the scripts.
my end goal is to get the distance as a global value that I can use in another script that will pasate sprites on the screen (numbers). like 00000. then as the player moves through the game, the numbers will update like this, 00001, 00002, 00003, and so on. I was thinking the script would be something like "if travel_distance > 5 then g_ones_slot = g_ones_slot +1, travel_distance = 0 end" then it repeats and continues adding to the g_ones_slot until it gets to 9 then reset to zero and add +1 to g_tens_slot. like "if g_ones_slot > 9 then g_ones_slot = 0, g_tens_slot = g_tens_slot +1 end". and so on for the g_hundreds_slot through the g_ten_thousand_slot. then have all the numbers stay 99999 after 99999 (that should be high enough that the player shouldn't ever max it out). So maybe have the script only run as long as the g_ten_thousand_slot is less than 9 "if g_ten_thousand_slot < 9" Then run the travel distance script.
My other script will handle the sprites. I was thinking something like "if g_ones_slot == 0 then PasteSpritePosition(ones_slot_image0,23.21, 96.58)" and so on for sprites 1-9. Then the same for g_tens_slot through g_ten_thousand_slot.
I hope I explained that well enough. Like I said in my original post, I've been thinking a lot about this. I'm still learning about LUA and scripting. Looking at how you guy's make your scripts helps me learn a lot. I already have other scripts doing the same type of thing with other numbers. I just need these global values to get my HUD finished. And I don't want the distance to go lower if you go back to the starting area.
Thanks Again. You guy's are awesome!!!
Here's a couple of pics of my HUD and camcorder overlay so far. (I plan on adding a timer and the distance to the other side of the screen)
The HUD has a sanity bar, infection bar, cam/flashlight battery bar, 3 different slots for Almond waters, and a slot for antibiotics. The cam/flashlight battery bar also works on the camcorder overlay. But the timer hasn't been added yet. I just put 99:99:99 for now. I've been working on this for weeks. I had to learn a ton to get them working.
UPDATE I just took a closer look at your script (smallg), and I only want the flat distance. I don't want altitude added.
Keep Making Stuff You Enjoy.