Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Script Halting (https://forums.graalonline.com/forums/showthread.php?t=61279)

Inverness 09-18-2005 04:30 AM

Script Halting
 
I'm wondering if there would be any way to halt a script at a certain point until some trigger is activated. I'm making a default GUI dialog set like JOptionPane in Java, and I want the player to be able to enter the value before the return is executed.

ChibiChibiLuc 09-18-2005 06:08 AM

Stefan said something about adding a command to stop NPCs while they're being modified..

calani 09-19-2005 07:05 AM

timeout()?
timeout with an if (flag)?
onKeypressed()?
event block with an if (flag)?

even if there isn't a command specifically designed to do this particular thing, there are other ways to do it.

Skyld 09-19-2005 08:29 PM

Quote:

Originally Posted by calani
timeout()?
timeout with an if (flag)?
onKeypressed()?
event block with an if (flag)?

even if there isn't a command specifically designed to do this particular thing, there are other ways to do it.

None of these examples can help, really.

It could be useful to have a way to pause a script, but the problem lies in deciding what should make the script resume.

calani 09-19-2005 10:21 PM

horribly simple way of doing it based on one of the suggestions i posted earlier:

NPC Code:

function onTimeout() {
if (!this.scriptpaused) {
stuff();
}
setTimer(.1);
}


napo_p2p 09-19-2005 10:48 PM

I think JOptionPane works a little like the Windows Form (in Java/C#) 'MessageBox'. The function halts until, for example, input is recieved. i.e

PHP Code:

if (MessageBox.Show("Bla Bla Bla") == [some button stuff]) 

Excuse the broken code (rusty), but (if completed) that shows a message box, and halted the function until the user acted on the MessageBox.

Inverness 09-19-2005 11:44 PM

I don't want to use a loop.
That = bad for what I want.

And Napo is exactly right, the function needs to halt until you get the input.

ZeLpH_MyStiK 09-20-2005 12:15 AM

Quote:

Originally Posted by calani
horribly simple way of doing it based on one of the suggestions i posted earlier:

NPC Code:

function onTimeout() {
if (!this.scriptpaused) {
stuff();
}
setTimer(.1);
}


that doesn't pause the script calani, the timeout's still running.
in gs1:
if (created) {
this.running=1;
timeout=.05;
}
if (playerchats) {
if (strequals(#c,run)) {
this.active=1;
timeout=.05;
}elseif (strequals(#c,stop)) this.active=0;
}
if (timeout && this.active==1) {
//script
timeout=.05;
}

napo_p2p 09-20-2005 12:23 AM

Quote:

Originally Posted by ZeLpH_MyStiK
that doesn't pause the script calani, the timeout's still running.
in gs1:
(stuff...)

I think she means that it pauses a certain part of a script.

But if there were some way to make Inverness' request work, that would be better than the timeout.

calani 09-20-2005 01:28 AM

Yes, though you could do that for everything else as well.
like i said before, even if there isn't a command specifically designed to do this particular thing, there are other ways to do it.


All times are GMT +2. The time now is 10:51 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.