TAB - thinBasic Adventure Builder

T.A.B. is an interactive fiction/text adventure program for Windows and made with thinBasic.
 
HomeFAQSearchUsergroupsRegisterLog in
Latest topics
» TAB Version 66 Available
Mon Sep 26, 2016 12:02 pm by catventure

» TAB Version 65 Available
Mon Feb 23, 2015 12:04 pm by catventure

» Incubation pt 1
Wed Apr 24, 2013 9:24 am by Kabrinski

» Charecter movements - doors
Wed Mar 20, 2013 2:55 pm by garethfx

» Member feedback on game planning
Sun Mar 03, 2013 1:47 pm by garethfx

» Still alive - just!
Thu Feb 28, 2013 11:34 am by catventure

» TAB 64 crashes ...
Mon Aug 20, 2012 11:31 am by acko

» Idea on addition to object being container
Sat Aug 18, 2012 3:49 pm by catventure

» sizex=y action ...
Thu Aug 09, 2012 11:29 am by catventure


Share | 
 

 Re: Random Messages

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

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

PostSubject: Re: Random Messages   Thu 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 64
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Re: Random Messages   Thu 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.

_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
stants
Experienced Adventurer
avatar

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

PostSubject: Re: Re: Random Messages   Fri 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
View user profile
catventure
Admin Adventurer
avatar

Male
Number of posts : 376
Age : 64
Location : UK
Humor : Enjoys a laugh!
Adventure Points : 52
Registration date : 2008-06-08

PostSubject: Re: Re: Random Messages   Fri 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.

_________________
http://tab.thinbasic.com ; Home of the TAB I.F. project.
Back to top Go down
View user profile http://adventure.rpgdynasty.com
stants
Experienced Adventurer
avatar

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

PostSubject: Re: Re: Random Messages   Fri 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
View user profile
Sponsored content




PostSubject: Re: Re: Random Messages   

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: