What should I know for plotscripts?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
LWFlouisa
Slime
Posts: 14
Joined: Mon Sep 07, 2015 1:25 am

What should I know for plotscripts?

Post by LWFlouisa »

To elaborate on my question, what things are most important to know for a beginning plotscripter?

While I was learning Ruby, I learned a basic run down of variables, strings, arrays, class/def, and text based graphics.

Are the string, array, and class/def structure formatted differently?

Thanks.

Edit: Found the dictionary, that might help a little bit. Though it might still be work to find out exactly what's most important for a workable game. (Going for draft mode at the moment.)
Last edited by LWFlouisa on Mon Sep 07, 2015 2:24 am, edited 1 time in total.
Arcade Day -- Complete -- Ruby IF
Cagaea -- Plotted -- OHRRPGCE
Mr. Clocktime -- In development -- OHRRPGCE
User avatar
kylekrack
Liquid Metal Slime
Posts: 1243
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Familiarizing yourself with the dictionary is a pretty good way to go. It has categories on strings, variables, and the likes. Variables work generally the same way, but strings are approached pretty differently. Also arrays don't even have a syntax so I guess that's different.

Oh and I assume you have it already, but if not, here's a link to the dictionary.
http://hamsterrepublic.com/ohrrpgce/docs/plotdict.xml[/list]
My pronouns are they/them
Ps. I love my wife
User avatar
Gizmog
Metal King Slime
Posts: 2622
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

We don't have arrays, so that'll help a little too :D
LWFlouisa
Slime
Posts: 14
Joined: Mon Sep 07, 2015 1:25 am

Post by LWFlouisa »

Yea one of the weird things about Ruby, and going back to game engines, is not having to use arrays as a way of displaying choices in text-adventures.:P

Yea I'll be taking a look at this, a little confusing. But I'll get used to it.^^
Arcade Day -- Complete -- Ruby IF
Cagaea -- Plotted -- OHRRPGCE
Mr. Clocktime -- In development -- OHRRPGCE
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

HamsterSpeak is a very simple and limited language. Once upon a time it was documented at HamsterSpeak Specification, and that article is a good thing to read if you want to understand (just a few) more details, but you can easily ignore it. (The Specification is out of date and doesn't document heaps of stuff that's instead documented in the Plotscripting Dictionary. I just updated it a bit, but it really ought to be rewritten from scratch.) Start by reading the Plotscripting Tutorial. The relevant sections of the dictionary are the first three (up to "Flow Control"), and String Functions. The rest of the dictionary documents regular commands.

HamsterSpeak doesn't have arrays, (true) strings, classes, etc, because there is only one data type: 32 bit ints. NPCs, slices, items, etc, are all referred to using either ID numbers as defined in Custom, or handles (integers referring to a specific instance of something). We do have "strings", which are also referred to using integer IDs; you can't operate on them or pass them around directly.
Last edited by TMC on Wed Sep 09, 2015 1:41 pm, edited 2 times in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1243
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

TMC wrote:HamsterSpeak doesn't have arrays, (true) strings, classes, etc, because there is only one data type: 32 bit ints. NPCs, slices, items, etc, are all referred to using either ID numbers as defined in Custom, or handles (integers referring to a specific instance of something). We do have "strings", which are also referred to using integer IDs; you can't operate on them or pass them around directly.
Is the absence of directly interactive strings an actual limitation of the language or does it just require an extra step to refer to them by ID's? By that I mean, is there anything more you could do with strings if you could directly manipulate them, or do you just need more lines of code?
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, there is a large difference. If strings were an actual part of the language then you would not have to manually manage string IDs, you could not run out of available strings, and it would mean that the language would have separate data types, allowing polymorphism (in a dynamically typed language). (We are planning to replace the HS interpreter and make it a dynamically typed language.)

For example when I scripted my roguelike I had to go to a lot of trouble to write scripts to dynamically allocate string IDs everywhere, but there was a string leak bug somewhere which resulted in eventually all the strings IDs being exhausted and the whole thing turning to custard.
Last edited by TMC on Thu Sep 10, 2015 2:25 pm, edited 1 time in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1243
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Ah ok. I do believe I've experienced that on a smaller scale. String IDs can be hard to manage. Maybe it would be easier to refer to them by globals or constants instead of numerical values.... I hope I get to see the day when HS supports polymorphism, along with the [s]million[/s] billion other things in the "some day" category.
My pronouns are they/them
Ps. I love my wife
User avatar
Gizmog
Metal King Slime
Posts: 2622
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

kylekrack wrote:String IDs can be hard to manage. Maybe it would be easier to refer to them by globals or constants instead of numerical values....
Cheat and use text slices
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

You can put string IDs in constants or variables. I almost never refer to strings using numbers, unless they are temporary and only used on the next line. I like to name my string constants/variables "str:name" and so forth. Also, a trick is that $id="..." returns id, so you can write for example 'show string($0="Something happened!")' and just pretend that the '$0=' part isn't there.
Last edited by TMC on Fri Sep 11, 2015 5:13 am, edited 3 times in total.
Post Reply