Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

[Answered] On Time with Scripting

16 years ago

First of all I was wondering whether it would be possible to create a sort of time and date system for a story.

 

I was thinking of time as a Variable but that wouldn't work for minutes. So I figure the best way to do it would be to make minutes and hours separate. So I was wondering if would be possible to make a Variable increase the number of another Variable when it gets to a certain number and then reset. So for every 60 minutes it would reset and add another hour.

 

Also I want to know of a way to set a Variable to see if an item has been used and perhaps set it back when used again. A sort of being equipped item. So 0 would be unequipped and 1 would be equipped, and say on a certain page it would check to see if the item was equipped or unequipped and would go to a certain page depending on which on it is.

[Answered] On Time with Scripting

16 years ago
It's not a good idea to put real time restrictions on readers. Better just to count the links passed through or somesuch.

[Answered] On Time with Scripting

16 years ago
Well I don't want restrictions as such more of certain events happening at certain times in certain areas .And not like real time but time passing for each action,

[Answered] On Time with Scripting

16 years ago
A time system, so through this you can make certain events available at one time a day, and others at other times? There's a thread, although it's probably quicker for me to get it direct from my storygame than searching for it.

%TIMECOUNT := %TIMECOUNT +1
The variable Timecount will be the same plus one after every link clicked.

IF %TIMECOUNT = 5 THEN
BEGIN
%TIMECOUNT:= 0
%TIME := %TIME + 1
END
If the variable Timecount equals five, then reset Timecount to zero, but add one to Time (hour).

IF %TIMECOUNT = 5 THEN
BEGIN
IF %TIME = 23 THEN
BEGIN
%COUNTER := 0
%TIME := 0
END
END
If Timecount equals 5 and Time equals 23 (end of day), then reset both Timecount and Time to zero.

That's all scripting, a unique style of getting things done that the creator of the site made. It probably doesn't make sense to you at the moment, but if you learn scripting you'll be able to get everything done quickly. Oh, and that goes in the Global Link Script.

[Answered] On Time with Scripting

16 years ago

Thank you October

 

Also if possible if anyone here knows of a way I also asked about using a Variable to equip and unequip an item and to check whether it is equipped or unequipped if anyone knows of a to this I'd like to know.

[Answered] On Time with Scripting

16 years ago
I wrote an article on it (involves scripting *sigh*) which shows exactly how to do it, but irritatingly enough there's been a bug with the thing that makes it work ($ITEMSTATE) which hasn't been fixed in a while.

Here is a link to the article if you want to read it (may be confusing again, if you need any help just ask for it). So yeah, it has been made, but there are problems with it.

[Answered] On Time with Scripting

16 years ago

If anyone is interested, I made a 24 hour digital clock system for one of my games. Make sure scripting is advanced mode, etc.

Variables required: hours, minutes, temphours

In the Global Page Script:

$PAGETEXT := $PAGETEXT + "The time is "

IF %HOURS < 10 THEN $PAGETEXT := $PAGETEXT + "0" + %HOURS + ":"
IF %HOURS < 13 THEN $PAGETEXT := $PAGETEXT + %HOURS +":"
IF %HOURS > 12 THEN
BEGIN
%TEMPHOURS := %HOURS - 12
IF %TEMPHOURS < 10 THEN $PAGETEXT := $PAGETEXT + "0" + %TEMPHOURS + ":"
IF %TEMPHOURS < 13 THEN $PAGETEXT := $PAGETEXT + %TEMPHOURS +":"
END

IF %MINUTES < 10 THEN $PAGETEXT := $PAGETEXT + "0" + %MINUTES
IF %MINUTES > 9 THEN $PAGETEXT := $PAGETEXT + %MINUTES

IF %HOURS < 13 THEN $PAGETEXT := $PAGETEXT + " AM"
IF %HOURS > 12 THEN $PAGETEXT := $PAGETEXT + " PM"

This results in messages at the bottom of every page, that might look like one of these examples:

The time is 08:45 AM

The time is 12:30 PM

The time is 03:02 PM

Then add this to your Global Link Script:

IF %MINUTES > 59 THEN
BEGIN
%MINUTES := %MINUTES - 60
%HOURS := %HOURS + 1
END

IF %HOURS > 24 THEN %HOURS := %HOURS - 24

To make the time change in the game, every link that takes up an amount of time must have a script attached to it. Simply add the line "%MINUTES := %MINUTES + X" where X is the number of minutes the action takes to perform, and/or add this line too "%HOURS := %HOURS + X" where X is the number of hours it takes to perform.

In the text for the link, I write the time the action will take in brackets, and then the link text. Ie, "(+5 min) You take a quick shower."

If you want more than an hour to pass, say, 72 minutes, don't add 72 minutes to the link's script, add 1 hour and 12 minutes in the link's script, so that the Global Page and Global Link scripts will work properly. Keep things in lots of 60 mins and 24 hours.

I've also got Days and Weeks in my game. In the Global Link Script, whenever hours > 24, I add an additional line of script that adds +1 to the day. In link scripts, a line can be added to make the variable DAYS change, and in the Global Link Script, every time DAYS > 7, add 1 to a WEEKS variable. Doing this, you could have events in your game that happen on certain days of the week, like, shops being closed on weekends, having to turn up for work by 9:00 AM, and stuff like that. I've been using this time system for a detective story I'm working on, where the player has a time limit in which to solve a case, and can go to different places and talk to people, etc.

[Answered] On Time with Scripting

16 years ago

Interesting well thanks I've done a bit of coding in the past but never really got much into and it's been awhile since I've had to really do much of any coding last time I did coding was when I write a script for a morrowind mod I was working on.

[Answered] On Time with Scripting

16 years ago
Morrowind and Oblivion are awesome! I love tinkering around with the editors.

[Answered] On Time with Scripting

16 years ago

Yeah, I haven't played Oblivion, but Morrowind was the BEST DAMN RPG I EVER PLAYED! I played an Argonian warrior type (although I did use magic and thieving skills a lot.) I have a mix of Ebony and Daedric armour (except boots, which I can't wear, and helmet, which can't be a full one, so I use a silver helm)

You've just won my respect Zarok. If you apply scripting patience to stories, you'll do very well.

[Answered] On Time with Scripting

16 years ago
Argonians are great!  I like Argonian magic users, personally. 

In Oblivion, they upgraded the water breathing ability so that it's not a spell you have to use, it's a permanent enchantment.  There's a whole dimension to dungeon delving that you don't even have to worry about when you can breathe underwater!

Uh, what were we talking about?

[Answered] On Time with Scripting

16 years ago

Yeah Morrowind and Oblivion were a lot of fun.

I liked the Dark Elves. For class I usually go with Battle Mage as my play style is mostly switching between Sword Fighting and Magic.

It was hard being a mage in morrowind cause of the whole magic doesn't regenerate thing. But they fixed that in Oblivion.

[Answered] On Time with Scripting

16 years ago

Hey welcome Zarok!

Glad you've delved into the adv editor, Alexp, Solostrike, Tsmpaul, madglee and October are probably our best scripters (maybe in that order even?) and if you need any help: They're the guys to go to.