Gammon Forum
Entire forum
Area Editor
General
I hope you might know... How to put a pause in this loop....
I hope you might know... How to put a pause in this loop....
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Pages: 1 2
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Wed 28 Jun 2006 06:17 PM (UTC) |
Message
| (This is my code don't pay attention to the first line, it's a reminder for me....)
say Remember to put a pause in every new room....
look at $n
if name($n) == Terra
south
look at $n
if name($n) != Sam
west
look at $n
if name($n) != Sam
northwest
look at $n
if name($n) != Sam
south
look at $n
if name($n) == Chris
east
look at $n
endif
endif
endif
endif
endif |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| David Haley
USA (3,881 posts) bio
|
Date
| Reply #1 on Wed 28 Jun 2006 06:54 PM (UTC) |
Message
| I think there is an mpsleep command that will pause a script for a given number of seconds. You use it like this: "mpsleep 3" where 3 means 3 seconds, I think. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #2 on Wed 28 Jun 2006 07:07 PM (UTC) |
Message
| Thank you for answering me, I will try your suggestion! |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #3 on Wed 28 Jun 2006 07:16 PM (UTC) |
Message
| The editor says it's not a valid command... |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| Zeno
USA (2,871 posts) bio
|
Date
| Reply #4 on Wed 28 Jun 2006 07:33 PM (UTC) |
Message
| Mpsleep is not part of stock Smaug. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #5 on Thu 29 Jun 2006 01:23 AM (UTC) |
Message
| Building pauses into scripts suffers from the same problem at the server end as doing it in the client. It isn't that easy. You can't just do "sleep (3 secs)" because that would hang everyone on the server.
You could need to have some system whereby the server remembers where it is in the script, and when the time is up keep executing it. This is not a trivial task.
Also you have the problem of what happens if the player leaves the room. Say they enter the room and it does "west" ... wait 3 seconds ... "northwest", but in the meantime (during the 3 seconds) the player has walked east. The whole thing won't work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #6 on Thu 29 Jun 2006 04:36 PM (UTC) |
Message
| Say Nick, Do you have any suggested code of some sort in some ressorce ?
Or is having a mobile be mobile just a lost cuase ? |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #7 on Thu 29 Jun 2006 04:46 PM (UTC) |
Message
| Would mpdelay work ???
|
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| David Haley
USA (3,881 posts) bio
|
Date
| Reply #8 on Thu 29 Jun 2006 04:56 PM (UTC) |
Message
| What do you mean, have "a mobile be a mobile"?
You can try using SmaugFUSS, which has this command, I believe.
If mpdelay is a command in your codebase, try it out and see what happens. But keep in mind what Nick warned about; if you depend on $n being present and in the meantime the player leaves, $n will no longer refer to the right person. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #9 on Thu 29 Jun 2006 05:00 PM (UTC) |
Message
| When I said a mobile being "mobile" I meant "mobile" like able to move... |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| Kingsmill
USA (78 posts) bio
|
Date
| Reply #10 on Thu 29 Jun 2006 05:02 PM (UTC) |
Message
| Would there be a way to use rooms instead of mobile's for my code ?? |
T.A.N.S.T.A.F.L.
There Aint No Such Thing As Free Lunch,
From the moon is a harsh mistress. | top |
|
Posted by
| David Haley
USA (3,881 posts) bio
|
Date
| Reply #11 on Thu 29 Jun 2006 05:31 PM (UTC) |
Message
| I know that mobile means able to move, I just am wondering what you mean in a bigger sense, because mobiles can all already move...
And what do you mean by using rooms instead of mobiles? Sure, you can put programs onto rooms, just use rpedit instead of mpedit. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
Posted by
| Conner
USA (381 posts) bio
|
Date
| Reply #12 on Thu 29 Jun 2006 06:31 PM (UTC) |
Message
| He hadn't said "mobile being a mobile", he'd said "mobile being mobile".. subtle difference, but.. anyway, I think he's trying to give a mob a specific set 'route' based on a flowchart style set of choices/presences, and he might want to take a look at the way the mayor spec_func was done for that and make one of his own for this mob instead of trying to do it via mobprog, or add in the mpsleep snippet to do what he's after. But yeah, overall, I agree, in general mobs are already quite mobile enough on their own unless you throw the sentinel flag on them. |
-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #13 on Thu 29 Jun 2006 09:03 PM (UTC) |
Message
|
Quote:
Say Nick, Do you have any suggested code of some sort in some ressorce ?
Well, since someone mentioned mpsleep, I did what I normally do in this situation and did a Google on that word. There are quite a few hits, the first one on this site (!) so the subject has come up before on this forum. Try that, and see what you find. There will be links to the snippet.
However I repeat my warnings about attempting this. I gather that if the player's name is not Sam you want them to go:
west
northwest
south
I can see a number of problems with this ...
- During the delay they may move, making them not go where you intended.
- Once they have moved one room (west) they are no longer in the room with the room program which makes them move, or the mob program, and thus they are out of range anyway of the script.
- Personally I would find it very annoying if a script started slowly moving me around. For example, I enter the room and it moves me west, so I think "hang on, I am looking around!" - so I got back east. Then it moves me northwest, and I start getting really annoyed. So I move back again. Then it moves me south and I start getting ready to complain to the admins that their game has a bug.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Conner
USA (381 posts) bio
|
Date
| Reply #14 on Fri 30 Jun 2006 06:53 AM (UTC) |
Message
| *L* While those are rather humurous scenarios, Nick, what he originally posted was that the mob that the prog is on enters the room, looks at target (how it finds this target is beyond me, perhaps it should use $r rather than $n...) and if that person is named "Sam" or "Terry" or whatever other name for that stage of the trigger, the mob then moves the direction listed below, repeat ad nausem. |
-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
58,494 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.