OK. I'm new to this whole coding thing. I'm getting the grasp of it but some things that I just can't get. I am still trying to figure out and for a long time i've been trying to figure out how to make a meter appear on the screen and how to update it when you lose damage and also gain health when u resting. Can someone help me out with that?
One more thing i really need help with. How to include time in the game? Like if i have a huge event that I want to plan out in my game and for the players to know when to come on. I also wouldn't want to use BYOND time but my own. How would i do that?
Thank for your help
ID:162489
Dec 31 2007, 3:53 pm
|
|
In response to Kaiochao2536
|
|
I tried adding some of the meters from the demos and it just made my game lag a lot and some errors. They weren't really errors but it just caused some of my already compiled work to disappear or not funtion properly without it having a compiling error.
As for the real world time, do i just put in the proc and the variable? |
In response to Jokah
|
|
1. You're not copy/pasting its code, are you? Afer all, it's a demo.
2. Look it up. F1 is the DM Reference. It contains descriptions of all types, built-in procs, and variables. |
In response to Kaiochao2536
|
|
proc/time2text(world.realtime) when i put this in, this error comes up
verbs.dm:86:error:time2text :invalid proc name: reserved word what now? |
In response to Jokah
|
|
ok i found something but it has compiling errors. I can't seem to fix it. Can u spot the problem?
world/New() // Called when world starts up LoadWorldVariables() // Calls a custom procedure to load saved global-related variables (such as day and year you would want to save) spawn() TimeDaySystem() // To tell you the truth, I dunno if spawn() should be here >_> I usually spawn() off loops at the beginning <_< world/Del() // When the game is shut down SaveWorldVariables() // Would be a good idea to save the day and year that passed by. ..() // Without the parent procedure, the default action would not pass - which is needed to actually shutdown the server.\ You don't need ..() if there's no default action (usually mentioned in the DM Ref) or if you did not overwrite it elsewhere. var // A few "global" variables day = 1 year = 0 daytime = 1 // Boolean variable :) 1 = day, 0 = night in this example proc/TimeDaySystem() while(1) // Infinite Loop sleep(20*600) // Define the time you want to pass before the day can change daytime = !daytime // "Inverts" value. If it was 1 (day), it is now 0 (night) and vice-versa if(daytime) // If the variable is true - read the link at the bottom - means it's daytime now... which means it's the next day! if(++day >= 366) // day++ is like (day+=1) at once :) So if the added day is = or more than 366, a new year begins day = 1 // It's a brand new day :) ++year // Increases year. Pre-increasement variables (++var) first returns the current value of var THEN adds 1 to the var. Post-increasement variables (var++) adds 1 to the var then returns the variable. // For example: XX = 25 //Pre-increasement (++var) // world << ++XX <-- 25 [announced to the world] // world << XX <-- 26 //Post-increasement (var++) // world << XX++ <-- 26 // world << XX <-- 26 |
In response to Jokah
|
|
You're calling procs incorrectly. time2text() is a built-in procedure. For example, this would be the time shown in a stat panel:
mob/Stat() Remember, you can always check the DM Reference for information on pretty much anything. Just hit F1 on your keyboard. |
In response to Kaiochao2536
|
|
ok. thanks.
|
In response to Jokah
|
|
Just one last question. How can you make items appear on the game screen? Like to show the time on the top left corner of the screen, etc.
|
In response to Jokah
|
|
If you read the demos on HUDs and meters instead of copy/pasting its code to your game(bad), you should have probably seen the screen_loc variable. Look it up in the Reference.
|
If your players aren't on, they wouldn't know the game's time.
If by time you mean real-world time, there's actually a variable for that, and a proc to translate it.
Variable: world.realtime
Proc: time2text(world.realtime)