Computer Science Canada using time to add to rpg |
Author: | goroyoshi [ Tue Apr 19, 2011 5:43 pm ] | ||
Post subject: | using time to add to rpg | ||
how can i use the time to tell the game if the marketplace is open i tried and failed
|
Author: | Tony [ Tue Apr 19, 2011 5:46 pm ] |
Post subject: | RE:using time to add to rpg |
from Time.Elapsed Quote: The Time.Elapsed function returns the amount of time since a program (process) started running. The number of milliseconds since the program started running is returned. |
Author: | Raknarg [ Tue Apr 19, 2011 5:49 pm ] |
Post subject: | RE:using time to add to rpg |
So are you trying to set it up so it opens at a specific time in real time? or are you doing some kind of hour based thing, where when you do some major action, an hour passes or something? |
Author: | goroyoshi [ Tue Apr 19, 2011 5:49 pm ] | ||
Post subject: | RE:using time to add to rpg | ||
whoops sorry, then "time"
yes, i would like to open the market when its a certain hour in real time |
Author: | Raknarg [ Tue Apr 19, 2011 5:56 pm ] |
Post subject: | RE:using time to add to rpg |
You should look up time before you use it, however; you set timepassed as a string and then use: time (timpassed) That will set timepasses as a string version of whatever time it is at the moment. For this problem, I would use strint. This converts a string into an integer. So to check the hour, you would use strint (timepassed (1 .. 2). Then you just compare the hour to the store's hours. |
Author: | goroyoshi [ Tue Apr 19, 2011 6:06 pm ] |
Post subject: | RE:using time to add to rpg |
im trying to use strint but it returns as illegal character in string passed to strint |
Author: | Raknarg [ Tue Apr 19, 2011 6:17 pm ] | ||
Post subject: | RE:using time to add to rpg | ||
Here, this might help. A random program i made with your stuff.
|
Author: | Raknarg [ Tue Apr 19, 2011 6:21 pm ] |
Post subject: | RE:using time to add to rpg |
You dont change time. You check a variable you set with time. It checks the first two numbers of whatever timepassed was when it got to the if statement, or at least it does in my program. |
Author: | goroyoshi [ Tue Apr 19, 2011 6:21 pm ] |
Post subject: | RE:using time to add to rpg |
ok i see, i missed the 1 .. 2 +1 karma |
Author: | Raknarg [ Tue Apr 19, 2011 6:22 pm ] |
Post subject: | RE:using time to add to rpg |
Yeah, checks only the hours. I beleive that in the morning its preceded by a zero, so it should work all hours of the day. EDIT: thx ![]() |