Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - CB..

#1
for the following character effect this might work


if (character[EGO].walking==1){
character[MAN].x=character[EGO].x + 10;
character[MAN].y=character[EGO].y + 10;}
#2
//add another timer to as room loads

SetTimer(3,300);
 
//then in repeatedly execute

if (IsTimerExpired(3)==1)
{int ran=Random(32);
if (ran==0) DisplaySpeechBackground (MAN,"red one");
else if (ran==1) DisplaySpeechBackground (MAN,"red two");
else if (ran==2) DisplaySpeechBackground (MAN,"red three");
else if (ran==3) DisplaySpeechBackground (MAN,"red four");
else if (ran==4) DisplaySpeechBackground (MAN,"red five");
else if (ran==5) DisplaySpeechBackground (MAN,"red six");
else if (ran==6) DisplaySpeechBackground (MAN,"red seven");
else if (ran==7) DisplaySpeechBackground (MAN,"red eight");
else if (ran==8) DisplaySpeechBackground (MAN,"red nine");
else if (ran==9) DisplaySpeechBackground (MAN,"red ten");
else if (ran==10) DisplaySpeechBackground (MAN,"red eleven");
else if (ran==11) DisplaySpeechBackground (MAN,"red twelve");
else if (ran==12) DisplaySpeechBackground (MAN,"red thirteen");
else if (ran==13) DisplaySpeechBackground (MAN,"red fourteen");
else if (ran==14) DisplaySpeechBackground (MAN,"red fiveteen");
else if (ran==15) DisplaySpeechBackground (MAN,"red sixteen");
else if (ran==16) DisplaySpeechBackground (MAN,"black two");
else if (ran==17) DisplaySpeechBackground (MAN,"black three");
else if (ran==18) DisplaySpeechBackground (MAN,"black four");
else if (ran==19) DisplaySpeechBackground (MAN,"black five");
else if (ran==20) DisplaySpeechBackground (MAN,"black six");
else if (ran==21) DisplaySpeechBackground (MAN,"black seven");
else if (ran==22) DisplaySpeechBackground (MAN,"black eight");
else if (ran==23) DisplaySpeechBackground (MAN,"black nine");
else if (ran==24) DisplaySpeechBackground (MAN,"black ten");
else if (ran==25) DisplaySpeechBackground (MAN,"black eleven");
else if (ran==26) DisplaySpeechBackground (MAN,"black twelve");
else if (ran==27) DisplaySpeechBackground (MAN,"black thirteen");
else if (ran==28) DisplaySpeechBackground (MAN,"black fourteen");
else if (ran==29) DisplaySpeechBackground (MAN,"black fiveteen");
else if (ran==30) DisplaySpeechBackground (MAN,"black sixteen");
else DisplaySpeechBackground (MAN,"black one");
SetTimer(3,300);
}  


///experiment with the timer amounts to get the cycle right..note the SetTimer at the
///end of the else if random section to make sure it repeats ,alter this amount allso to match


probably a neater way to do it but it should be ok
#3
theres a bit of a tutorial in the sticky technical archive ;
this works for me without blocking the game  and can be done for any number of characters in the background

///in as room loads///

SetTimer(2,200);

///in repeatedly execute///

if (IsTimerExpired(2)==1)
{int ran=Random(3);
if (ran==0) MoveCharacter(DD,character[DD].x,character[DD].y-70);
else if (ran==1) MoveCharacter(DD,character[DD].x,character[DD].y+70);
else if (ran==2) MoveCharacter(DD,character[DD].x+70,character[DD].y);
else MoveCharacter(DD,character[DD].x-70,character[DD].y);
SetTimer(2,200);
}    

///////

or just this for completely random movement..(in rep execute)

if (character[DD].walking!=1){
MoveCharacter(DD, Random(320),Random(200));}
#4
Advanced Technical Forum / Re:Display GUIs
Thu 18/03/2004 11:44:47
it kind of looks like the textbox is bigger than the GUI?
could yu use a smaller text box area (say enough for just three words) test it if it's any better than gradually increase the size of the text box untill the problem occurs..

is it possible to wordwrap in a textbox?
#5
as a short term answer
yu could go into the GUIS screen
i think the offending item will be the

STATUSLINE

click on the word in the list and it will be displayed for yu to edit..
then click on the image and a information box will become active allowing yu to edit the position on screen size width height etc..
i think yu will see the word PERSISTANT  on that info box which means its allways there (except when it gets hidden by the main icons) yu could change that to

popupmodal (double click on the persistant word and an option list will apear)
there should be some x and y screen co-ordinates that yu can edit to set an area on screen that pops up the statusline when yu mouse over that designated part of the screen..(same way as it does with the main icons)
yu sould set the mouse pop up area for the statusline at the bottom of the screen or later on when yu are happyier with experimenting with the code yu could ad a new button that switches the thing on and off when yu need it..(if yu do)
sorry this is a little vague  
before yu try this stuff click the export gui button at the bottom of the GUIS AGS screen and save the GUI ..that way if it all gets too confusing yu can just reload the original gui and no mayor harm done
hopefully more experienced heads can advise in deep fashion..
#6
ok cheers guys..
here we go....

int notes;
notes = ListBoxGetNumItems(0,6);
int ran;
ran = Random(notes - 1);

if (GetGlobalInt(3)==1) {
int ran=Random(notes - 1);
ListBoxSetSelected (0, 6, Random(ran));
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}



i'm happy because ive learnt something ...my neighbour's happy because he can store his poetry and quickly and easily experiment with randomising  the phrases (if thats the correct term for lines of poetry? i dunno..)

excellent  many thanks!!!
#7
i do apologise it seemed like the thing to do.. ;D
#8
double WOW!!
boy have i got a lot to learn!!

many many thanks !!

yikes thats some condensation of a lot of code!!!
amazing stuff!
#9
wow !! nice one ;D could you explain that a little for me?
that certainly looks like a real improvement!!
(just so i can learn a little from it)
#10
a neighbour has asked me to make a random "poetry" generator..
so i have a text box that he can type different sentences into..
and he can then store those sentences in a listbox...

he wants to then be able to press a button and have a random sentence displayed by the "game"

i have got it to work but the code is getting a bit clunky as the number of entrys in the listbox increases
is there a short hand way to do this?

///////////////////////////////////this is what i have so far  ///////////get global in 3 is the button////

int notes;
notes = ListBoxGetNumItems(0,6);

if ((GetGlobalInt(3)==01) && (notes == 4)){
int ran=Random(3);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else ListBoxSetSelected(0,6,3);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 5)){
int ran=Random(4);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else ListBoxSetSelected(0,6,4);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 6)){
int ran=Random(5);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else ListBoxSetSelected(0,6,5);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 7)){
int ran=Random(6);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else ListBoxSetSelected(0,6,6);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 8)){
int ran=Random(7);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else ListBoxSetSelected(0,6,7);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 9)){
int ran=Random(8);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else ListBoxSetSelected(0,6,8);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 10)){
int ran=Random(9);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else if (ran==8) ListBoxSetSelected(0,6,8);
else ListBoxSetSelected(0,6,9);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 11)){
int ran=Random(10);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else if (ran==8) ListBoxSetSelected(0,6,8);
else if (ran==9) ListBoxSetSelected(0,6,9);
else ListBoxSetSelected(0,6,10);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 12)){
int ran=Random(11);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else if (ran==8) ListBoxSetSelected(0,6,8);
else if (ran==9) ListBoxSetSelected(0,6,9);
else if (ran==10) ListBoxSetSelected(0,6,10);
else ListBoxSetSelected(0,6,11);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 13)){
int ran=Random(12);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else if (ran==8) ListBoxSetSelected(0,6,8);
else if (ran==9) ListBoxSetSelected(0,6,9);
else if (ran==10) ListBoxSetSelected(0,6,10);
else if (ran==11) ListBoxSetSelected(0,6,11);
else ListBoxSetSelected(0,6,12);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}
else if ((GetGlobalInt(3)==01) && (notes == 14)){
int ran=Random(13);
if (ran==0) ListBoxSetSelected(0,6,0);
else if (ran==1) ListBoxSetSelected(0,6,1);
else if (ran==2) ListBoxSetSelected(0,6,2);
else if (ran==3) ListBoxSetSelected(0,6,3);
else if (ran==4) ListBoxSetSelected(0,6,4);
else if (ran==5) ListBoxSetSelected(0,6,5);
else if (ran==6) ListBoxSetSelected(0,6,6);
else if (ran==7) ListBoxSetSelected(0,6,7);
else if (ran==8) ListBoxSetSelected(0,6,8);
else if (ran==9) ListBoxSetSelected(0,6,9);
else if (ran==10) ListBoxSetSelected(0,6,10);
else if (ran==11) ListBoxSetSelected(0,6,11);
else if (ran==12) ListBoxSetSelected(0,6,12);
else ListBoxSetSelected(0,6,13);
string buffer;
ListBoxGetItemText (0,6,ListBoxGetSelected(0,6),buffer);Display ("%s",buffer);SetGlobalInt(3,00);}


///////it's going to get redicoulous as i get up towards 30 or so listbox entrys
#11
Beginners' Technical Questions / Re:timer
Tue 09/03/2004 00:56:50
many thanks Scorpiorus
wil move the int my_counter =0 into
the main global script thanks for clearing that up...it's hugely frustrating as a newbie to read these mouth watering sections of code in the manual only to be completely left without any clue as to even the need to place the diferent parts in specific parts of the code (let alone which ones and where..it really doeant even mention this.....i had actual given up on ever understanding this stuff...only reading the forums finally clued me in to the idea of what to do...)

thanks for the timer explanation aswell...that helps me to get a handle on things
cheers again!

#12
ok many thanks guys that makes sense, will do// maths has never been my strong point i have to admit
#13
 ;D many thanks again , that solves it
#14
 ;D im a newbie what can i say!!

the dcdepth is used elswhere to control an animated depth guage..so i thought i'd try to re-use the same int (as it has the same function...telling the game how deep the submarine is)
re-using the dcdepth name tage for the int allows me to easily keep track of what int is doing what (my brain is only 64mb) it all works but if dcdepth hits 0 (ie the sub is surfaced) then the game crashes...it does show an inform CJ message so i thought id post the question
#15
i know the soloution is to avoid dividing by 0 but im using ints and constantly changing global variables to try to create a damage sytem for my ye old "subsim"

heres the basic code

int damage1, damage2, result;
damage1 = 1000;
damage2 = dcdepth;
result = 1000/dcdepth;
Display("%d", result);



///dcdepth is GetGlobalInt (7) which is altered by the submarine changing depth/////

this is with the stable 2.61 release
any thoughts? shud i be trying to set it up to stop global int 7 from reaching 0 or is it a bug
#16
i'd love a non blocking Wait command
it would be so easy to set a

WaitEx(200);

to delay events without having to use the timers or special functions..

the preview animation window would be very handy as well as being just a really nice touch

more than  5 (perhaps 10?)  animated backgrounds would be extremely  too,
very good for creating high quality animated backgrounds and just really usefull for swopping the backgrounds with SetBackgroundFrame  in order to squeeze a huge amount of functionality out of a single room..all those   if GetBackgroundframe possibilitys give you the ability to simply set up variuos functions for/with the same room with the minimum of experience.anyhuw many thanks for AGS , yu given me the chance to have fun with computer code without having to have a brain transplant to do it..!!  cheers!!
#17
Advanced Technical Forum / Re:Scripting
Sun 07/03/2004 14:09:59
try clicking on the hot spots with the hand icon /the walk icon doesn't use anyclick ? (which confused me for a while )
#18
Beginners' Technical Questions / Re:timer
Sun 07/03/2004 10:34:09
i dont know where i'd be without this forum!!
thanks Scorpious; the only thing as a newbie that i find lacking in the manual/tutorials (which are comprehensively brilliant otherwise) is the tendency to ommit telling the newbie exactly in which part of the game script to place each part of the code, i rely on the forum to accidently answer these questions for me!!..ill browse and search untill i stumble across an example then im away..thanks)


i spent hours on
experimenting with the my_counter tutorial before i sussed that i needed to put the

int my_counter = 0;

in the script header

seperate from the repeatedly execute section

//////then put in repeatedly execute//

if (my_counter == 600)
{my_counter = 0;}    
if (my_counter < 600)
{my_counter ++;}
if ((my_counter >= 0) && (my_counter < 200)) {if (character[DD].walking==0){
MoveCharacter(DD, Random(320),Random(200));}}
if (my_counter == 250) {if (character[DD].walking==0){
MoveCharacterPath(1, character[EGO].x, character[EGO].y);}}
if (my_counter == 450) {if (character[EGO].walking==1){
MoveCharacterPath(1, character[EGO].x, character[EGO].y);}}
if (my_counter == 599)
{DisplaySpeech(EGO, "1.");}


/////this was based on the in game help untitled tutorial pages..

reason i mention this is as Hadjiguru says using the timers can be fiddly and i wanted to create my own timers that i could use for multiple events and also for non blocking wait commands..



/
when yu are using the

function GiveAbility(int seconds) {
SetTimer(1, seconds*GetGameSpeed());
special_ability = 1;
}

function repeatedly_execute() {
if (IsTimerExpired(1)) special_ability = 0;
}


SetTimer
and IsTimerEpired entrys in the function
are they refering to a normal timer or does this give the special ability a timer function
is what is happening that yu have created timer(1) and renamed it to special_abilty?
meaning yu cant use Timer(1) for anything else...?
#19
Beginners' Technical Questions / Re:timer
Fri 05/03/2004 10:23:33
Many thanks Ferret , keep them coming..
#20
Beginners' Technical Questions / Re:timer
Fri 05/03/2004 10:12:43
ah sorry fogot about the close bracket..

but i'm still confused about the !=


if you are using "!=" and that means "not equal to"  
then the statement reads as

if  is timer number one expired "not equal to"  "yes"

that means when the timer is not expired..  run the code?

is there a list  of all the available similar expressions?
for example whats the difference between "==" and just plain "="


//he he!! hang on i see where im loosing the plot

as a newbie i tend not to use timers with an "else" statment..

ie this sort of thing


if (IsTimerExpired(2)==1)
{if ((character[EGO].walking==0) && (character[DD].walking==0)){
MoveCharacter(DD, Random(320),Random(200));
}
SetTimer(2,200);
}    
if (character[EGO].walking!=1){
if (IsTimerExpired(3)==1)
{MoveCharacterPath(1, character[EGO].x, character[EGO].y);
SetTimer(3,200);}}


//which  might explain why it doesnt work very reliably..

i can see that a computer would prefer an either/ or option ?
is that right?
SMF spam blocked by CleanTalk