Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-18-2005, 04:30 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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.
__________________
Reply With Quote
  #2  
Old 09-18-2005, 06:08 AM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
Stefan said something about adding a command to stop NPCs while they're being modified..
Reply With Quote
  #3  
Old 09-19-2005, 07:05 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to 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.
__________________
Reply With Quote
  #4  
Old 09-19-2005, 08:29 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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.
__________________
Skyld
Reply With Quote
  #5  
Old 09-19-2005, 10:21 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to 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);
}

__________________
Reply With Quote
  #6  
Old 09-19-2005, 10:48 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 09-19-2005, 11:44 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
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.
__________________
Reply With Quote
  #8  
Old 09-20-2005, 12:15 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
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;
}
__________________
Reply With Quote
  #9  
Old 09-20-2005, 12:23 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #10  
Old 09-20-2005, 01:28 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
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.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:15 PM.


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