ID:149971
Jan 14 2002, 3:51 pm
|
|
I am having a run time when people use macros. How can i make it like a .5 sec delay? like put sleep(50) some were?
|
Jan 15 2002, 2:39 pm
|
|
ok its been a day sorry but imm bumping. This is a real problem that i saw somewere on how to fix. Now i know one of you guys know.
|
Ur better off reposting than bumping. Bumping is highly frowned upon. The answere to your question: using sleep() will not work, since it sleeps the current proc, and no the entire client. What you want to do, is keep the time stored in a variable.
var/lastmacro verb/macro() if(world.realtime >= lastmacro) lastmacro = world.realtime + 10 usr << "Ok" else usr << "Waiting" This code will not work copy paste though. However, by looking at it, you should get the general idea. |
In response to Scoobert
|
|
Scoobert wrote:
ok its been a day sorry but imm bumping. This is a real problem that i saw somewere on how to fix. Now i know one of you guys know. in your original post you say you have a run-time, there is no such thing as "a" run time, but there is such a thing as a run-time error. run time error's happen during run-time(meaning when you are playing the game in dream seeker) Now, assuming you have a problem with people using macros and abusing it, that would not be considered a run time error. FIREking |
In response to FIREking
|
|
ok well i tried that thing you told me and didt do a thing. I tried many simular things too. Oh ya i want to credits give thing but i cant get it to work heres what i got:
mob/verb Give_Credits(mob/M) var/give give = input(usr, "How much do you wish to give?", "Give") usr.give -= usr.credits usr << "you give [give] credits to [M]" usr.give += M.credits M << "[usr] gives you [give] credits" can you tell me whats wrong with that? |
In response to Scoobert
|
|
Indentation is screwy, and the code will lead to negitive credits, here's what you can do:
mob/verb/Give_credits(mob/M as mob in oview(3)) |
In response to Nadrew
|
|
thanks worked like a charm. Now what about my runtime? Well someone sed it wos not a run time but no matter it still has to be fixed
|
In response to Scoobert
|
|
It'd be so much nicer if you actually posted what we need to answer your question.
|
In response to Nadrew
|
|
ok its on the first post on this tread but my problem is that im geting runtimes when people use macros (ex.) hp = null.....mob/usr/slash() .
I dont remeber what is was egsacly. But i have a battle system much like most dbz games. I want it to ether stop macros from being used or delay them by like .5 sec so that i dont get theys errors and it has time to tell the diffrence from a dead enemy that hasent had time to be removed and has a HP or null or a living one with hp with a #. Does that make a little more sence? |
In response to Scoobert
|
|
Scoobert wrote:
ok its on the first post on this tread but my problem is that im geting runtimes when people use macros (ex.) hp = null.....mob/usr/slash() . there is no such thing as "a" runtime, its called a run-time error. Run-Time is when you are running the program, and a run-time error is when you get an error during run-time. FIREking |
In response to FIREking
|
|
well whatever you want to call it, i just want to know how to fix it
|
In response to Scoobert
|
|
Scoobert wrote:
well whatever you want to call it, i just want to know how to fix it lol, ok. fix a runtime error by preventing it from happening. you can do that by reading what the runtime error says, and then conjuring up a way to prevent that from happening. FIREking |
In response to FIREking
|
|
grr thats no help at all, would i make a statement like
if( HP == null) return else bla bla bla ? p.s. it tells me HP=null in the error |
In response to Scoobert
|
|
Scoobert wrote:
grr thats no help at all, would i make a statement like first off, you are getting in the bad habit if not putting who owns it in front of it. src.hp now, i have seen your code, so you will have to figure it out on your own, but here is what you can do. If the verb has something to do with a mob, then you should always check to see if its null or not mob/verb/talk(mob/M as mob in oview) if(M != null)//if the mob isnt null, then go on //do whatever if you are checking for stats, its the same thing, just make sure you list the owner of the variable, it makes things more precise, and easier to remember whats going on during design time. mob/verb/increase() if(src.hp != null)//if the source's hp variable isnt null src.hp += 25 now, hopefully you actually LEARNED! If you have, you wont need to reply. FIREking |
In response to FIREking
|
|
hey thats olmost what i ment :) but what does the ! mean i have seen it but never used it.
|
In response to Scoobert
|
|
look it up, dont you have any sense?
press f1 in dream maker, and look up the != operator btw, moron, i commented what the statement meant! FIREking |
In response to FIREking
|
|
your mean you know that :"( lol
|