View previous topic :: View next topic |
Author |
Message |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Wed Jan 21, 2004 1:38 pm Post subject: Triggering multiple scripts |
|
|
Is there a way that one can trigger multiple scripts all at once? (all to run at the same time)
Thanks,
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Cube Dimensional Traveller

Joined: 02 Feb 2003 Posts: 294
|
Posted: Wed Jan 21, 2004 3:15 pm Post subject: |
|
|
Nope. You can trigger more than one script through the use of autonumber scripts, but they won't perform their actions simultaneously. Although there are tricks that can be done to simulate it, depending on how complex the task is... PM me or post your idea if you want, and we'll see if we can do what you want. |
|
Back to top |
|
 |
Guest
|
Posted: Wed Jan 21, 2004 6:12 pm Post subject: |
|
|
Hmm... I've wondered this myself. I wish that there was a plotscript command like "NewThread(script)" or something that would call a plotscript and continue without wait for it to terminate. But no such luck.
But multiple scripts can be run at the same time (okay, not at the same time, but concurrently).
I think there are a couple of ways to trigger script concurrency, though I have not tried them myself (I heard of them from others -- probably from Cube )
One way is to have an NPC that runs a script when activated, then use plotscripting to activated the NPC. (problem: consumes an NPC slot)
Another way, or so I've heard, is to use texboxes in largely the same way as the NPC triggering. Call a textbox that uses a script instead. But again, I haven't tried this myself.
What do you think, Cube? Would these work?
Eh...I really shouldn't be posting things that I'm not sure about... |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Wed Jan 21, 2004 6:13 pm Post subject: |
|
|
*sigh* That was me. The instructor suddenly took over the desktops and I guess I automatically logged out. Whoops. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Thu Jan 22, 2004 2:28 am Post subject: |
|
|
You may only ever have one script executing at once, fullstop. When a new script is loaded, because you entered a map with autorun, talked to an npc, ran the script as a command within another script, etc, the currently active script is paused until the new one finishs.
So scripts can build up like a stack of plates, with the top one being the active one, and new ones going on top, pausing what ever is below it(press F10 in game, and you will see all currently loaded scripts in the order they were loaded). Think of it that way: when one script finishs, the HS interpreter returns to running the next script beneath it.
You can fake multi-tasking like this:
script, main (
while (continue game) do (
player input()
move enemies()
calculate attacks()
wait (1)
)
)
Where each of the tasks contain no wait commands, so that they all run and return to the main loop within one interpreter cycle.
Good reference. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Thu Jan 22, 2004 9:24 am Post subject: |
|
|
Really...
That might explain why I had some trouble with Pitch Black... Whenever I ran the instead-of-battle script, the on-keypress script refused to be called.
I thought that game.exe toggled between scripts every line. Hmm... But this makes more sense.
I'll have to look over the PB code in light of this new information. Thanks! |
|
Back to top |
|
 |
*Worthy* Critical Thinker

Joined: 11 Aug 2003 Posts: 186
|
Posted: Thu Jan 22, 2004 1:07 pm Post subject: |
|
|
What if I wanted to have, say, five NPCs moving in a completely unique paths during a mini-game. How would I go about doing that? I would also want the player to be able to press keys to have the hero move/shoot or whatever.
Thanks,
~Worthy _________________ You can do whatever you want...but prison is full of people who make bad decisions. |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Thu Jan 22, 2004 9:53 pm Post subject: |
|
|
are you having a script checking what key the player is pressing..?
if so, add a few commands to the script to check the positions of the npcs continuously...
Code: | while(mini-game) do(
if(key is pressed) then(move hero)
if(npcx(number)==32,and,npcy(number)==10) then(walknpctox(60))
) |
and so on and so forth... easy manipulationg, just that you'll need to figure out how you're going to execute that type of movement. _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
RedMaverickZero Three pointed, red disaster! Halloween 2006 Creativity Winner


Joined: 12 Jul 2003 Posts: 1459
|
Posted: Fri Jan 23, 2004 2:46 am Post subject: |
|
|
There's something I saw from Hamster Republic in the Documentation part. It says stuff about how to run a Zelda Attack thing. I don't understand it, but you expert scripters have a significantlly different area of thinking compared to standard OHR Programmers. I think it's like Moogle1's Plotscripting Library up there. Well, it's one of em. It shows a whole bunch of scripts. But when I tried to use em, a whole buncha errors popped up. _________________ ---------------Projects----
Mr.Triangle's Maze: 70%
Takoyaki Surprise: 70% |
|
Back to top |
|
 |
|