Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : Help me script (yes, I've already searched for this)
New Topic New Poll Post Reply
Poster Message
Chalks
Level: Master Delver
Avatar
Rank Points: 267
Registered: 04-17-2005
IP: Logged
icon Help me script (0)  
Wow, that was annoying. For the first time in over a year of using firefox....it crashed!

anyways, back to the point. I'm building a hold right now, and using scripts for the first time. I already read the stickied post about scripting, and the ingame help. But, I can't figure out how to do this: Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?

Second, can I put variables in my script? like so:
label "begin"
if...goto "xyz"
x=7
x+1=x
goto "begin"
label"xyz"
speech "tada!"


??? Thanks!
01-19-2006 at 07:28 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
eytanz
Level: Smitemaster
Avatar
Rank Points: 2708
Registered: 02-05-2003
IP: Logged
icon Re: Help me script (+1)  
Chalks wrote:
Wow, that was annoying. For the first time in over a year of using firefox....it crashed!

anyways, back to the point. I'm building a hold right now, and using scripts for the first time. I already read the stickied post about scripting, and the ingame help. But, I can't figure out how to do this: Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?

There's no simple way to do that. The scripting engine isn't very adaptable - if you tell a character to wait x turns, it can't check anything until x turns are over.

Using a loop and if statements, you can check for more than one condition each turn, but then you can't count.

However, if your script always starts at the beginning of the room, then you can do it, because instead of checking for "x turns have passed" just check for "turn y" (i.e., instead of saying "wait for 10 turns", say "wait until it is turn 11". Since that doesn't require counting by the script engine, you can combine that with another condition. If you need help in how to do that, let me know.

Second, can I put variables in my script?

No.

____________________________
I got my avatar back! Yay!

[Last edited by eytanz at 01-19-2006 07:38 PM]
01-19-2006 at 07:38 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
krammer
Level: Smitemaster
Rank Points: 904
Registered: 02-12-2003
IP: Logged
icon Re: Help me script (+1)  
Variables aren't possible, and as such I don't think what you asked for first is possible directly. How many turns does your NPC need to wait? It might be possible by having a walled off area which an NPC walks down, and note the position where he would be on turn x. Then your main NPC can have this script:
Move to (x,y)
Label Waiting
If.. go to xyz
Wait for player at (wherever)
If.. go to xyz
Wait for NPC at (position x)
Wait 1 turn
GoTo Waiting
Label xyz


Does that make sense?

____________________________
+++ Divide by Cucumber Error +++ Please Reinstall Universe and Reboot +++

"Oook!"
01-19-2006 at 07:42 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5200
Registered: 02-04-2003
IP: Logged
icon Re: Help me script (+1)  
Chalks wrote:
I can't figure out how to do this: Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?
So, if I understand correctly, you want an NPC that waits up to X turns before going somewhere. If you know X specifically, then you can just add X checks for Beethro, one per turn, like so:
If ... goto <zyx>
Wait for Beethro at (x,y)
Wait 1 turn
Repeat this code X times, and have Label xyz at the end of it.

Otherwise, if you know ahead of time what specific turn # the NPC will be waiting for (like Eytan mentioned), the above can be wrapped into a loop:
Label Loop
If ... goto <zyx>
Wait for Beethro at (x,y)
Wait 1 turn
If ... goto <zyx>
Wait for turn #             ;are we done looping?
Goto Loop
Label zyx
...


____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
01-19-2006 at 08:54 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
geomatrx
Level: Smiter
Avatar
Rank Points: 339
Registered: 08-31-2004
IP: Logged
icon Re: Help me script (0)  
Chalks wrote:
...Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?
My turn...
label abc
wait 1 turn
if goto xyz
wait for playey (x,y)
goto abc
label xyz
Move NPC to (x,y)


____________________________
Get my holds:
MetDROiD AE
MetDROiD Prime

MetDROiD Echoes
Deadly Gold Mine of Death (Architecture)

[Last edited by geomatrx at 01-19-2006 11:47 PM]
01-19-2006 at 11:46 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Chalks
Level: Master Delver
Avatar
Rank Points: 267
Registered: 04-17-2005
IP: Logged
icon Re: Help me script (0)  
Thank you, thank you, thank you!

This helps tremendously, and it's all exactly what I was looking for. I'm going to have a lot of fun with this. :D
01-20-2006 at 03:32 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Doom
Level: Smitemaster
Avatar
Rank Points: 3336
Registered: 07-05-2004
IP: Logged
icon Re: Help me script (0)  
geomatrx wrote:
Chalks wrote:
...Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?
My turn...
label abc
wait 1 turn
if goto xyz
wait for playey (x,y)
goto abc
label xyz
Move NPC to (x,y)
I don't think this would work. It keeps repeating the loop until Beethro gets in the specified area. The label xyz should be activated after the loop has been executed x number of times, even if Beethro doesn't go to the (x,y)

The others seem to be fine, though.
01-20-2006 at 05:05 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
geomatrx
Level: Smiter
Avatar
Rank Points: 339
Registered: 08-31-2004
IP: Logged
icon Re: Help me script (0)  
Doom wrote:
geomatrx wrote:
Chalks wrote:
...Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?
My turn...
label abc
wait 1 turn
if goto xyz
wait for playey (x,y)
goto abc
label xyz
Move NPC to (x,y)
I don't think this would work. It keeps repeating the loop until Beethro gets in the specified area....

Thats what I was aiming for. Waiting for Beethro to fill that tile, then the script will continue.

Perhaps I mis-understood.

g

____________________________
Get my holds:
MetDROiD AE
MetDROiD Prime

MetDROiD Echoes
Deadly Gold Mine of Death (Architecture)
01-20-2006 at 12:38 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Doom
Level: Smitemaster
Avatar
Rank Points: 3336
Registered: 07-05-2004
IP: Logged
icon Re: Help me script (0)  
geomatrx wrote:
Thats what I was aiming for. Waiting for Beethro to fill that tile, then the script will continue.

Perhaps I mis-understood.
Yes. Waiting for Beethro to fill that tile should make the script continue.

But also,

Waiting x amount of turns and NOT going on the tile with Beethro should make the script continue as well. It's a bit more complicated than that.
01-20-2006 at 02:27 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
eytanz
Level: Smitemaster
Avatar
Rank Points: 2708
Registered: 02-05-2003
IP: Logged
icon Re: Help me script (+1)  
geomatrx wrote:
Doom wrote:
geomatrx wrote:
Chalks wrote:
...Make a npc go to a spot, wait x turns (while checking every turn to see if beethro's in a certain spot), then going to label xyz. If beethro is in that certain spot, stop waiting the rest of the turns and just skip straight to label zyx. How do I do it?
My turn...
label abc
wait 1 turn
if goto xyz
wait for playey (x,y)
goto abc
label xyz
Move NPC to (x,y)
I don't think this would work. It keeps repeating the loop until Beethro gets in the specified area....

Thats what I was aiming for. Waiting for Beethro to fill that tile, then the script will continue.

Perhaps I mis-understood.

g

If that's all you want, there's no need for a loop - just use the "wait for player at xyz" command.

____________________________
I got my avatar back! Yay!
01-20-2006 at 05:12 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Swivel
Level: Master Delver
Avatar
Rank Points: 236
Registered: 09-14-2005
IP: Logged
icon Re: Help me script (0)  
On a related note, I'm trying to do a script where Beethro is wandering through wraithwing fields. If he enters from a certain path, the wraithwings will continue along their merry way (going back and forth). But once he crosses past a force arrow from an alternate entrace, the wraithwings will end the script on room exit and turn into a monster. This has to be done like thus:

Appear at (9,9)
Label "Begin"
Face southeast
Move to (10,10) Forbid Turning
If go to "Attack"
Wait for player at (5,2)-(5,2)
Move to (11,11) Forbid Turning
If go to "Attack"
Wait for player at (5,2)-(5,2)
Move to (12,12) Forbid Turning
If go to "Attack"
Wait for player at (5,2)-(5,2)
... and likewise ... this is getting a little boring ...
Go to "Begin"
Label "Attack"
End on room exit
Turn into monster

This could be simplified down to:

Appear at (9,9)
Label "Begin"
Face southeast
Loop 10 times [or likewise command, using variables if you want]
Move southeast forbid turning
If go to "Attack"
Wait for player at (5,2)-(5,2)
Go to Loop
Face northwest
Loop 10 times
Move northwest forbid turning
If go to "Attack"
Wait for player at (5,2)-(5,2)
Go to Loop
Go to "Begin"
Label "Attack"
End on room exit
Turn into monster

This may seem the same length, but it really isn't (as I've omitted at least 45 lines from the top script). I echo Doom: this is really complicated! Or at least tedious.

____________________________
"Write a wise saying and your name will live forever."
-Anonymous
01-20-2006 at 05:19 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : Help me script (yes, I've already searched for this)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.9
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.