Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Arjunaz78 on Thu 08/09/2011 20:09:46

Title: Walk over the screen,cutscenes & Dialog script [SOLVED]
Post by: Arjunaz78 on Thu 08/09/2011 20:09:46
1st sorry for my bad 'English'..

I've multiple of question here,i been search using search forum menu but somehow it's appear 'database error' warning,meanwhile i search using the web (google & yahoo site) but still not find the answer..

1st - I want to know how to make character move/walk over or pass the screen when he walk of the end of cutscene & when need to change new room..(sorry, i  still rookie on scripting/c++ coding..)

2nd  - I want to make a dialog that includes the Dialog (for example - "Are you sure want to throw that key") and the Option 1 ("YES") and Option 2 ("NO") and when the player click "YES" the game will ended (using QuitGame(); code) well the "NO" Option do nothing (return character to the game) but i don't know to put that code because many times i put & insert the code in Dialog script,it's always appear error syntax,why?besides i don't know how to put/include that code using global script editor..please help me...i'm new here..

3rd - I want to know how to use the image insteads of text,when make a cutscene/intro,it is support for animate image?and is that anyway i can use the video/clip on cutscenes/intros?

TY.
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: poc301 on Thu 08/09/2011 21:28:19
Hi Arjunaz,

1) To move the character, you want to use cCharacterName.Walk(x,y,blockingvalue);

This will make them walk to the X, Y coordinate, and blocking or no blocking is whether you want to make the game wait until they get there.

Then you can use player.ChangeRoom(##); to make the player change to a new room number.

2) You want to set up the dialog with the yes and no as options to click on.  Then for the script you want to use:

run-script ##
return

This will run the script # when that dialog is clicked.  The script can be entered in the game's global script under dialog options.


3) To make images, you just create them and import them into the game, and set them as objects.  You can assign them views and set the animations to run when needed by using object.Animate command.

Thanks,

Bill

Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: pcj on Thu 08/09/2011 22:47:45
For 2) please note you can put the script right in the dialog now.  dialog_request() is pretty much deprecated.

Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: poc301 on Thu 08/09/2011 23:34:02
Quote from: pcj on Thu 08/09/2011 22:47:45
For 2) please note you can put the script right in the dialog now.  dialog_request() is pretty much deprecated.



Did not now!  Thanks for the input :)

-Bill
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: pcj on Thu 08/09/2011 23:35:54
If you are getting a syntax error, you may need to check your code for...syntax errors.  Generally this is a misplaced parentheses or bracket.  If you can provide the exact error you are getting that will be helpful.
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: Arjunaz78 on Sat 10/09/2011 19:43:31
Oh..so very confusing here..actually i don't know where to put that script on (whether on Global Script,Dialog Script File or Room Script) because i've done many of the dialog script using the Dialog Script File & Room Script only.
But..anyway thanks bro..
i've done to making that scripts but on different way (look so confusing to myself :-P) without use the..

run-script ##
return   

or   

dialog_request()


I don't make any changed on my Global Script editor,instead i make an editing on my room script plus with added the new dialog in Dialog script file menu (not in Global Script editor).

As shown on the picture 1,i just create a new dialog with "dTKey" name on it and then put the option text "YES" and "NO" while in the dialog script file i've added..

@1
  QuitGame(0);
return

and

@2
stop

(http://img191.imageshack.us/img191/4662/dialogscript.th.png) (http://imageshack.us/photo/my-images/191/dialogscript.png/)


Then,on the picture 2,i added "dTKey.Start(); at the end of "function Beach2_UseInv()" on room1 in room script file,then when i try running the game with the key in my inv. and try to throw that into the beach (Hotspot),the dialog on "dTKey" running and gosh..the script actually running properly by itself.

(http://img714.imageshack.us/img714/2293/roomscript.th.png) (http://imageshack.us/photo/my-images/714/roomscript.png/)

However,i think i take a wrong way to doing it,because it's look very confusing to myself and i think i make a very "noob" style by making the script like that. :-P

Anyway..thanks for your help buddy..i appreciated with your help,your knowledge is very usefull for me..thanks :) :) :)

Finally,please forgive me for my bad ENGLISH,i still learn it :) :) :)
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: Khris on Sun 11/09/2011 13:38:49
Looking only at the last picture, you need to put the code inside { and }.

function Beach2_UseInv() {

  if (player.ActiveInventory == iKey) {    // open block with {

    player.Walk(...);
    ...
  }                  // close it with }
}


Otherwise, only the Walk command is executed depending on whether ActiveInventory is iKey, and the rest of the commands every time.
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: Arjunaz78 on Sat 17/09/2011 20:50:38
(http://img685.imageshack.us/img685/7536/roomscrbeach2.th.png) (http://imageshack.us/photo/my-images/685/roomscrbeach2.png/)

I finish re-edit the script that you told me like picture a attach above,but is it the same way with you said before?

Is that means if only when i have for example the "Key" (iKey) in my inventory items menu,i can interact & use the "Key" only insteads of interact & use the other items/objects for the same actions,means that only use spesific items/object for different case & create a different function for every items/objects in inventory items?

Besides,i've detect a different actions when added { and } that you told me before..that only the items (Key (iKey)) set in for example:


function cArjunaz_UseInv()
{
  if (cEgo.ActiveInventory == iKey) {
  player.Walk(116, 167);
  Wait(80);
  cEgo.Say("Here's the key");
  Wait(40);
  cArjunaz.SpeechColor = 10;
  cArjunaz.Say("What do you want to know, bro?");
  dKey.Start();
  }
}


..will be trigger without conflict with the other items/objects.

And one more thing that i don't understand (because in AGS tutorial & densming video on YouTube explain that) why i need to put { and } mark on different syntax/code in the same function together?is it works for the other codes plus i've no experience in c++/c/c# language) why i need to put { and } inside the code that already have { and } mark?What is it the function use for?Is it use for the Objects/Items only?

last thing..why only the Walk command will trigger/executed?Besides i already put the code in the same function?

sorry..guys..i ask a very noob Q in this,but i like it because it becomes challenging to me..besides i very very very like AGS Games..

p.s - Once again,sorry for my Bad English.
Title: Re: Walk over the screen,cutscenes & Dialog script
Post by: pcj on Sat 17/09/2011 21:04:47
In AGS, you need the brackets for functions, if statements, while statements, structs and other advanced scripting objects.  They keep together a section of code and define what commands are run.  For instance, in your code you have function brackets and if brackets, the outer function brackets contain the commands within that function.  The if brackets contain the code that will only be run if the statement is true.  It's not uncommon to see multiple nested layers of bracketed commands (with functions, while loops, and if statements) so it's not hard to get confused.  Most people indent the lines between the brackets for clarity.