TAB - thinBasic Adventure Builder
Would you like to react to this message? Create an account in a few clicks or log in to continue.

TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeLatest imagesSearchRegisterLog in
Latest topics
» How was it done? Implementing in-game clocks
Re: Random Messages I_icon_minitimeToday at 9:54 am by catventure

» How to engage in intelligent conversation with NPCs?
Re: Random Messages I_icon_minitimeYesterday at 9:01 pm by catventure

» refine player-available gender/name options
Re: Random Messages I_icon_minitimeMon Nov 18, 2024 6:04 pm by catventure

» Incubation pt 1
Re: Random Messages I_icon_minitimeSun Nov 17, 2024 4:22 pm by catventure

» Happy New Year 2024!
Re: Random Messages I_icon_minitimeSun Dec 31, 2023 4:04 pm by catventure

» TAB Version 71
Re: Random Messages I_icon_minitimeMon Aug 21, 2023 12:17 pm by catventure

» TAB Version 70
Re: Random Messages I_icon_minitimeSun Oct 02, 2022 1:49 pm by catventure

» TAB Version 70
Re: Random Messages I_icon_minitimeFri Sep 30, 2022 10:23 pm by catventure

» TAB Version 70
Re: Random Messages I_icon_minitimeMon May 23, 2022 4:08 pm by catventure


Share | 
 

 Re: Random Messages

View previous topic View next topic Go down 
AuthorMessage
stants
Experienced Adventurer
stants

Number of posts : 71
Age : 50
Location : Maidstone, Kent, UK
Humor : I shall tear your soul Apart!!!!!
Adventure Points : 32
Registration date : 2009-09-16

Re: Random Messages Empty
PostSubject: Re: Random Messages   Re: Random Messages I_icon_minitimeThu Jul 21, 2011 8:30 am

Ive been playing a text adventure game called KnightOrc on the Amiga.

I just wondered how the following could be done by tab.

After location description and visible objects and locations described i want to print a random message.

Something like "You can hear someone screaming in the distance" .

How would i create random messages after location and exits descriptions.

I guess something in the script 2 editor.

Kind Regards

Stants
Back to top Go down
catventure
Admin Adventurer
catventure

Male
Number of posts : 410
Age : 72
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Re: Random Messages Empty
PostSubject: Re: Re: Random Messages   Re: Random Messages I_icon_minitimeThu Jul 21, 2011 4:56 pm

stants wrote:

Ive been playing a text adventure game called KnightOrc on the Amiga.
How would i create random messages after location and exits descriptions.
I guess something in the script 2 editor.

Hi Stants. I remember that game from Level 9 Computing. Good game Smile

One way is to use "randomizeflagX,Y" in Script 2. You can qualify it with a location condition check as well if necessary...

This action inserts a random number from the range 1 to Y and loads it into into flag X each time the entry is triggered.

For example:

SCRIPT 2
========

[start]room=3[acts]randomizeflag100,10#rem: insert random number from 1 to 10 into flag 100[end]

[start]room=3#flag100=3[acts]cmessYou can hear someone screaming in the distance![end]

In the example that message will only be output if the player is in room 3 and the random number contained in flag 100 was equal to 3. In other words there's a 10% chance of that occurring when the player moves to room 3 or types "look" in that room...

To make the message itself random you can use the %r% formatting tag within "cmess" to allow different messages.

There's some example random message outputs in Script 2 list of "char_commands_demo.tab" example database which show this in action.

Regards,
Phil.
Back to top Go down
https://adventure.forumotion.com
stants
Experienced Adventurer
stants

Number of posts : 71
Age : 50
Location : Maidstone, Kent, UK
Humor : I shall tear your soul Apart!!!!!
Adventure Points : 32
Registration date : 2009-09-16

Re: Random Messages Empty
PostSubject: Re: Re: Random Messages   Re: Random Messages I_icon_minitimeFri Jul 22, 2011 6:34 am

ahhh ok thanks phil. Hmmm i dont really want to check what room you are in. I would like to print random messages after every location is described.
So say I have 10 random messages and i want to print one of these after every location.
Ok so i can use %r% to print different messages.
Hmmm how does this work exactly.
Ok so if i use your first code to store a random number from 1 to 10 in a flag.
Then after location text check to see what number the flag contains.
How would i code the random messages exactly.
Thanks
Stants
Back to top Go down
catventure
Admin Adventurer
catventure

Male
Number of posts : 410
Age : 72
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 77
Registration date : 2008-06-08

Re: Random Messages Empty
PostSubject: Re: Re: Random Messages   Re: Random Messages I_icon_minitimeFri Jul 22, 2011 8:50 am

stants wrote:

I would like to print random messages after every location is described.
So say I have 10 random messages and i want to print one of these after every location.
Ok so i can use %r% to print different messages.
Hmmm how does this work exactly.

Hi Stants,

I think I understand your question now...

Better to use Script 1 Editor for what you're trying to accomplish. This will now only display the random message after each location describe/redescribe and not after every turn as is the case with Script 2.
The random message will be printed for ALL locations (as there are no conditions in the entry) which I think was what you wanted.
However if that is not the case then you may need to qualify it further with some conditions...

SCRIPT 1 entry
======
[start][acts]cmessI am message 1.
%r%I am message 2.
%r%I am message 3.
%r%I am message 4.
%r%I am message 5.
%r%I am message 6.
%r%I am message 7.
%r%I am message 8.
%r%I am message 9.
%r%I am message 10.[end]

Appends a random message element to room description when each location is described.
Note the last element of the message does not need a carriage return.
If you need a blank line after the message then simply add a "newline" action to the code like so:

SCRIPT 1 entry
======
[start][acts]cmessI am message 1.
%r%I am message 2.
%r%I am message 3.
%r%I am message 4.
%r%I am message 5.
%r%I am message 6.
%r%I am message 7.
%r%I am message 8.
%r%I am message 9.
%r%I am message 10.#newline[end]

Hope this helps.

Phil.
Back to top Go down
https://adventure.forumotion.com
stants
Experienced Adventurer
stants

Number of posts : 71
Age : 50
Location : Maidstone, Kent, UK
Humor : I shall tear your soul Apart!!!!!
Adventure Points : 32
Registration date : 2009-09-16

Re: Random Messages Empty
PostSubject: Re: Re: Random Messages   Re: Random Messages I_icon_minitimeFri Jul 22, 2011 12:10 pm

cool thanks phil. Ill try that later on and see if it works ok.
Thankyou very much!!
Back to top Go down
Sponsored content




Re: Random Messages Empty
PostSubject: Re: Re: Random Messages   Re: Random Messages I_icon_minitime

Back to top Go down
 

Re: Random Messages

View previous topic View next topic Back to top 

 Similar topics

+
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
TAB - thinBasic Adventure Builder :: TAB FORUMS :: General Forum-
Jump to: