Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : The BIG thread about scripting
Page 1 of 2
2
New Topic New Poll Post Reply
Poster Message
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon The BIG thread about scripting (0)  
Talk about whatever about DROD RPG scripting.

Set _Sword to 5, BTW. Or 6. :D

List of Things Made:
Leveling System (every 100 REP, lvl up. Every lvl up, +2 ATK, +2 DEF, +25 HP)
Weak Roach (orange, 75 HP, 15 ATK, 5 DEF, 2 GR, 2 REP)
Inventory System (command, takes you to room where you can store swords, shields, items, and greckles, plus healing)

____________________________
lurking

[Last edited by Monkey at 09-27-2008 06:50 PM]
09-13-2008 at 03:33 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
hyphz
Level: Delver
Rank Points: 34
Registered: 01-02-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
Is there an Event for "whenever the Player kills a monster (any monster)"?

Monster Engaged doesn't seem to work properly (in Bugs thread) and Monster Stabbed doesn't seem to fire at all.

Also, the following:

Label "KillLoop"
Speech Self, 2, "$SideKills$"
Wait for event Monster engaged
Set var SideKills + 1
Go to "KillLoop"

Results in the SideKills counter increasing constantly once an enemy is engaged! Is there a way to get the event out of the event buffer?

[Last edited by hyphz at 09-13-2008 06:38 PM]
09-13-2008 at 06:34 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
Wait 0.

____________________________
lurking
09-13-2008 at 06:49 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
rman
Level: Smiter
Avatar
Rank Points: 371
Registered: 09-24-2007
IP: Logged
icon Re: The BIG thread about scripting (0)  
This NPC should say: "0" (wait for event) "123456789...." Because it doesn't wait next times because the event was the same turn as it's checked. Try putting the label after the speech, and copy the speech to before the go to. Also insert a wait 0 turns between the speech and the go to.

EDIT: Post collision.

____________________________
Click here to view the secret text

Best quote ever (TSS ending spoiler):
Click here to view the secret text


[Last edited by rman at 09-13-2008 06:49 PM]
09-13-2008 at 06:49 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
hyphz
Level: Delver
Rank Points: 34
Registered: 01-02-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
Thanks!

One other question, how do you input the "On" command?

09-13-2008 at 06:58 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
rman
Level: Smiter
Avatar
Rank Points: 371
Registered: 09-24-2007
IP: Logged
icon Re: The BIG thread about scripting (0)  
hyphz wrote:
Thanks!

One other question, how do you input the "On" command?

The... "On" command?

____________________________
Click here to view the secret text

Best quote ever (TSS ending spoiler):
Click here to view the secret text

09-13-2008 at 07:02 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
hyphz
Level: Delver
Rank Points: 34
Registered: 01-02-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
The... "On" command?

In the "RPG Test" hold currently on CaravelNet for the RPG, the bottom-rightmost character has "On" as their first command, which apparantly creates an event handler. But there seems to be no way to enter this command, even cutting and pasting it did not work.

09-13-2008 at 07:03 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Pekka
Level: Smiter
Rank Points: 302
Registered: 09-19-2007
IP: Logged
icon Re: The BIG thread about scripting (0)  
How do I make custom weapons and armor with special powers?

If you're willing to step me through the whole process, you could show me, for example, a sword that does something funky every time I press Shift-Tab.

09-16-2008 at 04:23 PM
View Profile Show all user's posts This architect's holds Quote Reply
Sillyman
Level: Smiter
Avatar
Rank Points: 339
Registered: 09-08-2006
IP: Logged
icon Re: The BIG thread about scripting (+3)  
Pekka wrote:
How do I make custom weapons and armor with special powers?

If you're willing to step me through the whole process, you could show me, for example, a sword that does something funky every time I press Shift-Tab.

Unless Shift-Tab is the (edit) key to make weapons do things (whoops wrong terminology)(which it is) that's impossible. However, I can show you how to make a sword that does something each time you activate it. (Via clicking on it, same way as you activate accessories like the pocket roach and potions)

Here's what we shall be making today: An origami item that, when activated, turns into the next kind of item.

The way we shall do this is by making several different items, that each give the player the next one then destroy themselves.

First, the standard equipment making process:
Make an NPC. In the script editing screen, hit the Characters button. Make four custom character types called "Origami Sword", "Origami Shield", "Origami Crane", and "Origami Quest Log". Give each a graphic if you want.

Now, select the Sword and hit Edit Default Script. Add the following commands:

Set Var _MyATK = 20
Each Use "Fold"
Imperative Ghost Display
Wait for player to touch me
Equipment Swap Weapon Origami Sword
Imperative No Ghost Display
Go To "End"
Label "Fold"
Label "End"

This is how you make any custom item. Note that the character type must be present in order for Equipment Swap to work. The Each Use, corresponding label, and jump to end (don't use End, it'll permanently stop the script) don't have to be there for a normal item, but it does if you want it to do something special. You can also try Each Attack on swords and Each Defend on armor.
So now when you step on the sword it'll give you itself, then disappear.

You need something under that Fold label... since we want an item that can turn into each different type of items, you can just put in:

Equipment Swap Armor Origami Shield
Equipment Destroy Weapon

That's all for this script. Open the Shield default script. Unless you want it to be placable in your hold in any form, you don't need to add in most of the script commands from earlier. Just use:

Set Var _MyDEF=20
Each Use "Fold"
Go To "End"
Label "Fold"
Equipment Swap Accessory Origami Crane
Equipment Destroy Armor
Label "End"

The Accessory is the same, except instead of a stat boost, we want a behavior. Say... Behavior Lucky instead of Set Var _MyDEF or _MyATK, making it give you twice as much gold. Then the next Equipment Swap is a Command.

Finally, we have the Origami Quest Log. This one's special because what it does for you is on the same button as folding it. So what do we do? We use a question!

Use nothing in place of the behavior/stats. Reference the label "Use" for each use instead of "Fold".
In between the "Use" labels, put the following:

Answer Option "View Quest Log": Go to Quest Log
Answer Option "Fold": Go to Fold
Label "Quest Log"
[insert speech statements reflecting progress here]
Go to "End"
Label "Fold"
[insert fold script to go back to weapon here]

____________________________
Who, me?
FNORD

[Last edited by Sillyman at 09-18-2008 07:40 AM]
09-16-2008 at 08:11 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Pekka
Level: Smiter
Rank Points: 302
Registered: 09-19-2007
IP: Logged
icon Re: The BIG thread about scripting (+1)  
Thanks. I will try this when I'm on my computer again. It's thorough enough so I'm sure I won't have any probs.

Shift-Tab and Ctrl-Tab are the default ways to active weapon and armor special abilities according to the Help (IIRC). I thought that you could write a script to respond to them as you can respond to the Special Command, but apparently you can't (?). I would hope the docs would be a little clearer about what they are and when they are used.

If knowing that requires having played the official hold, then I'm guilty of not yet buying and playing it. :blush

Anyway, there's no harm done. I think I can script anything I actually want to put in a potential RPG hold already, and besides I have this classic DROD hold to finish :)
09-17-2008 at 10:03 AM
View Profile Show all user's posts This architect's holds Quote Reply
13th Slayer
Level: Disabled
Avatar
Rank Points: 27
Registered: 09-28-2007
IP: Logged
icon Re: The BIG thread about scripting (0)  
How to attach a script to cmd button, darnit?
09-17-2008 at 06:08 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Tim
Level: Smitemaster
Avatar
Rank Points: 1979
Registered: 08-07-2004
IP: Logged
icon Re: The BIG thread about scripting (0)  
13th Slayer wrote:
How to attach a script to cmd button, darnit?
Not helping people who cannot say please and cannot read help files.

Not helping trolls either.

____________________________
The best way to lose customers is to let little kids running loose on a forum with too many mod points.
09-17-2008 at 07:28 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Sillyman
Level: Smiter
Avatar
Rank Points: 339
Registered: 09-08-2006
IP: Logged
icon Re: The BIG thread about scripting (+1)  
Pekka wrote:
Shift-Tab and Ctrl-Tab are the default ways to active weapon and armor special abilities according to the Help (IIRC). I thought that you could write a script to respond to them as you can respond to the Special Command, but apparently you can't (?). I would hope the docs would be a little clearer about what they are and when they are used.

Oh. Yeah, then that's definitely possible, and exactly correct and what I just told you. The label referenced by the "Each Use" command is gone to each time you hit the command button/click your items/press whatever key combo you have them mapped to.

____________________________
Who, me?
FNORD
09-18-2008 at 07:37 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Yellow_Mage
Level: Master Delver
Rank Points: 267
Registered: 05-19-2004
IP: Logged
icon Re: The BIG thread about scripting (0)  
I have a question: is it possible to wrangle custom behavior, specifically making a single enemy type weak against a weapon like with Goblin Biter?

____________________________
"Sit and daydream, and watch the changing color of the waves that break upon the idle seashore of the mind." - Henry Wadsworth Longfellow


Click here to view the secret text

09-20-2008 at 04:14 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Stuwy
Level: Master Delver
Avatar
Rank Points: 212
Registered: 04-10-2003
IP: Logged
icon Re: The BIG thread about scripting (0)  
Question: Is there a way to answer a question that in every different choice consumes different amount of greckles? (eg. like buying items from a shop)


09-22-2008 at 12:33 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
I don't understand what you mean. Perhaps rewording it would help?

____________________________
lurking
09-22-2008 at 12:48 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Tim
Level: Smitemaster
Avatar
Rank Points: 1979
Registered: 08-07-2004
IP: Logged
icon Re: The BIG thread about scripting (-1)  
Stuwy wrote:
Question: Is there a way to answer a question that in every different choice consumes different amount of greckles? (eg. like buying items from a shop)
Yes.

____________________________
The best way to lose customers is to let little kids running loose on a forum with too many mod points.
09-22-2008 at 01:14 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Stuwy
Level: Master Delver
Avatar
Rank Points: 212
Registered: 04-10-2003
IP: Logged
icon Re: The BIG thread about scripting (0)  
Tim wrote:
Stuwy wrote:
Question: Is there a way to answer a question that in every different choice consumes different amount of greckles? (eg. like buying items from a shop)
Yes.

Splendid! I've never used the question/answer command in DROD so bear with me, I'm probably going to ask a lot of questions in the near future...
09-22-2008 at 02:23 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Chaco
Level: Smitemaster
Rank Points: 3648
Registered: 10-06-2005
IP: Logged
icon Re: The BIG thread about scripting (0)  
You'll need a label at the end of the script called "End" or somesuch and some go to "End"s after each option finishes executing or the code from one option will keep running and go into other options, and it'll get messy.

A loop to allow the store to be used more than once during the entire hold would be a good idea also.

____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text

09-22-2008 at 02:52 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
Someone Else
Level: Smitemaster
Avatar
Rank Points: 2340
Registered: 06-14-2005
IP: Logged
icon Re: The BIG thread about scripting (0)  
Chaco wrote:
You'll need a label at the end of the script called "End" or somesuch and some go to "End"s after each option finishes executing or the code from one option will keep running and go into other options, and it'll get messy.

A loop to allow the store to be used more than once during the entire hold would be a good idea also.
Or just add "Repeat every entrance", or whatever that command is.
09-22-2008 at 07:28 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
Stuwy
Level: Master Delver
Avatar
Rank Points: 212
Registered: 04-10-2003
IP: Logged
icon Re: The BIG thread about scripting (0)  
Chaco wrote:
A loop to allow the store to be used more than once during the entire hold would be a good idea also.

That's exactly what I want to do with my shop! So far I've been able to display a multiple choice window with my options clearly, what's bugging me is:

1.) I can't get the script to repeat itself when I leave and re-enter the room. (My answer options have been labeled but the 'goto' command is probably in the wrong place)

2.) I can't figure out how to set vars and subtract the amount of gold from each choice. (As of now I make the choice and it opens the door for me to get to the item, but no gold penalty is applied)

3.) Once I have an answer chosen, how would I remove that answer from the multiple choice window so it won't display the chosen answer again?

Thanks for the help guys!

[Last edited by Stuwy at 09-22-2008 08:35 PM]
09-22-2008 at 08:34 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon Re: The BIG thread about scripting (+2)  
Stuwy wrote:
Chaco wrote:
A loop to allow the store to be used more than once during the entire hold would be a good idea also.

That's exactly what I want to do with my shop! So far I've been able to display a multiple choice window with my options clearly, what's bugging me is:

1.) I can't get the script to repeat itself when I leave and re-enter the room. (My answer options have been labeled but the 'goto' command is probably in the wrong place)
For that, you need an "Imperative: Restart Script on Exit".
2.) I can't figure out how to set vars and subtract the amount of gold from each choice. (As of now I make the choice and it opens the door for me to get to the item, but no gold penalty is applied)
To reduce the amount of greckles a player has, use "Set Variable _GR - (amount)".
3.) Once I have an answer chosen, how would I remove that answer from the multiple choice window so it won't display the chosen answer again?
Put

If...
Wait for variable (item)NoBuy = 0
Answer Option (text): (label)
Set variable (item)NoBuy = 1
If End


in place of just "Answer Option (text): (label)", with the item being sold to be in place of "(item)".

Hopefully that works. :D

____________________________
lurking

[Last edited by Monkey at 09-22-2008 08:53 PM]
09-22-2008 at 08:51 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Stuwy
Level: Master Delver
Avatar
Rank Points: 212
Registered: 04-10-2003
IP: Logged
icon Re: The BIG thread about scripting (0)  
Monkey wrote:
To reduce the amount of greckles a player has, use "Set Variable _GR - (amount)".
3.) Once I have an answer chosen, how would I remove that answer from the multiple choice window so it won't display the chosen answer again?
Put

If...
Wait for variable (item)NoBuy = 0
Answer Option (text): (label)
Set variable (item)NoBuy = 1
If End


in place of just "Answer Option (text): (label)", with the item being sold to be in place of "(item)".

Hopefully that works. :D
I don't understand how to make that var command. I don't see the 'nobuy' option in the list.

I can now reduce different amount of gr. from each choice, the problem is, my greckles go into the negatives if I make a purchase with no gr. Kind of defeats the whole purpose eh? :D
09-22-2008 at 10:25 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Yellow_Mage
Level: Master Delver
Rank Points: 267
Registered: 05-19-2004
IP: Logged
icon Re: The BIG thread about scripting (+1)  
You create a new variable, NoBuy.

For the problem of negative Greckles, use an If

If
Wait for var _GR less than (amount you want)
Speech cmd [throw back a line that you don't have enough Greckles]
Else
Goto (label name which the transaction happens)

Something like that.

____________________________
"Sit and daydream, and watch the changing color of the waves that break upon the idle seashore of the mind." - Henry Wadsworth Longfellow


Click here to view the secret text

09-23-2008 at 12:21 AM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Sillyman
Level: Smiter
Avatar
Rank Points: 339
Registered: 09-08-2006
IP: Logged
icon Re: The BIG thread about scripting (+1)  
Yeah, to create your own variables (The name doesn't matter, since variables you create yourself do nothing except be accessible to scripts), go to the Set Var command, type the name you want in the text field, then hit add.

____________________________
Who, me?
FNORD
09-23-2008 at 01:25 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Monkey
Level: Master Delver
Avatar
Rank Points: 190
Registered: 03-21-2006
IP: Logged
icon Re: The BIG thread about scripting (0)  
BTW, the (item) in (item)NoBuy was supposed to be replaced by the item being sold, or first word if 2 words. :? So for example, (item)NoBuy when selling a Speed Potion would become SpeedNoBuy.

____________________________
lurking

[Last edited by Monkey at 09-24-2008 12:49 AM]
09-24-2008 at 12:48 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Yellow_Mage
Level: Master Delver
Rank Points: 267
Registered: 05-19-2004
IP: Logged
icon Re: The BIG thread about scripting (0)  
One of my unsual crazy thoughts, is it possible to give the player the ability to create pits? Thinking Lode Runner... do __MyScriptX and _MyScriptY are these values for placement? Don't 100% understand everything, but a vague hint at a possibility would be good, so I don't end up hitting a brick wall again and start making crappy graphics again.

____________________________
"Sit and daydream, and watch the changing color of the waves that break upon the idle seashore of the mind." - Henry Wadsworth Longfellow


Click here to view the secret text

09-24-2008 at 08:54 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: The BIG thread about scripting (+5)  
Yellow_Mage wrote:
One of my unsual crazy thoughts, is it possible to give the player the ability to create pits? Thinking Lode Runner... do __MyScriptX and _MyScriptY are these values for placement? Don't 100% understand everything, but a vague hint at a possibility would be good, so I don't end up hitting a brick wall again and start making crappy graphics again.

This can be done fairly easily. Create a new Custom Character called... oh, let's just call it Shovel. Give it the following example Default Script:
  Each use Cmd
  Go to End
Label Cmd
  Set var "_MyScriptX" = _X
  Set var "_MyScriptY" = _Y
  Set var "_MyScriptW" = _O
  If ... 
        Wait until var "_MyScriptW" < 3
     Set var "_MyScriptY" - 1
  If End 
  If ... 
        Wait until var "_MyScriptW" > 5
     Set var "_MyScriptY" + 1
  If End 
  Set var "_MyScriptW" % 3
  If ... 
        Wait until var "_MyScriptW" = 0
     Set var "_MyScriptX" - 1
  If End 
  If ... 
        Wait until var "_MyScriptW" = 2
     Set var "_MyScriptX" + 1
  If End 
  Set var "_MyScriptW" = -9999
  If ... 
        Wait until var "_MyScriptX" < 0
     Go to Fail
  If End 
  If ... 
        Wait until var "_MyScriptX" > 15
     Go to Fail
  If End 
  If ... 
        Wait until var "_MyScriptY" < 0
     Go to Fail
  If End 
  If ... 
        Wait until var "_MyScriptY" > 15
     Go to Fail
  If End 
  If ... 
        Wait for item Pit,0,0,0,0
     Go to Fail
  If End 
  Build Pit,0,0,0,0
  Go to End
Label Fail
  Set var "_MyScriptX" = _X
  Set var "_MyScriptY" = _Y
  Game effect Center,Parry,0,0,On
Label End
  Set var "_MyScriptX" = -9999
  Set var "_MyScriptY" = -9999

Then, create a character in a room, and give it the command "Equipment Swap Command Shovel".

Now, when you play that room, the player will have a Command that when used, will build a Pit in the direction the player is facing. It will fail and make a 'parrying' sound (with an X mark over the player as well, since that's what that game effect does - you can use another game effect if you want) if there's already a pit there or you try to build out of bounds.
09-24-2008 at 09:22 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Yellow_Mage
Level: Master Delver
Rank Points: 267
Registered: 05-19-2004
IP: Logged
icon Re: The BIG thread about scripting (0)  
... I love you. Amazing.

____________________________
"Sit and daydream, and watch the changing color of the waves that break upon the idle seashore of the mind." - Henry Wadsworth Longfellow


Click here to view the secret text

09-24-2008 at 09:35 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
Remlin
Level: Master Delver
Rank Points: 181
Registered: 04-28-2005
IP: Logged
icon Re: The BIG thread about scripting (+2)  
Label Top
  Wait for entity Player 7,10,7,10
  If ... 
        Wait until var "_GR" > 99
     Answer option "Not now, maybe later.",Don't buy
     Answer option "Buy a green key for 100 gold.",Buy
     Question Buy a green key for 100 gold?
Label Buy
     Set var "_GR" - 100
     Set var "_GreenKeys" + 1
     Speech "Pleasure doing business with you!",Normal,Self,0,.
     End 
  If End 
  Speech "You don't have enough gold - go away.",Normal,Self,0,.
Label Don't buy
  Wait while entity is Player 7,10,7,10
  Go to Top


10-30-2008 at 12:25 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Page 1 of 2
2
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : The BIG thread about scripting
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.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.