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 - Scorpiorus

#2101
No, because AGS have to know about your function. See this thread:http://www.agsforums.com/yabb/index.php?board=6;action=display;threadid=5376

-Cheers
#2102
Quote from: Synthetique on Tue 20/05/2003 15:05:19
can i use it only to be seen in a window..
Actually I think of adding a function allowing resizing and positioning of a window, the snow/rain runs in.
#2103
QuoteI want to make the opportunity to pick up a character
To pick up a char you need to make an inventory item which represents your character. Then add next code into the character's interaction:


character[<name>].room = -1; // remove the char from the screen.
AddInventory(<char item>);   // add inv. item representing the char.


Quoteand even when i have the character in my inventar the possibility to go on talking to him.
Here you should make some interaction with inventory item which runs a dialog you want. Of course you need to place the real character into the current room in order to be able to talk to him. After the dialog has been finished you may remove the character again.

-Cheers
#2104
 Just add if (character[DOG].walking == 0) statement. That's because if you run MoveCharacter() repeatedly it won't move (it will be starting again all the time). Checking for co-ordinate won't help as actual movement is started after a loop or something so the character position is not changed.

inside room's_repeatedly:

if (character[DOG].walking == 0) {
 if        (character[DOG].x == 384) MoveCharacter (DOG, 151, 152);
 else if (character[DOG].x == 151) MoveCharacter (DOG, 384, 156);
}

-Cheers
#2105
Possibly, but keep in mind it could slow down a game a *LOT* (especially with transparencies turned on) so I would recommend you to use 640x480 instead.
#2106
Snake: I hadn't posted it in a separate thread. The one I had anounced the plugin in is here: http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=2326
#2107
I am afraid setting baselines do not help. If you set a low baseline just on the bottom white line it'll help a bit. But for left, right and upper lines it won't. The plugin dosn't support walkbehindes because of perfomance reasons. The only way to do what you what is to make four always-on GUIs representing each side of the border as the GUI is the only thing that is drawen over the rain/snow sprites.

-Cheers
#2108
It was the very first (test) version. The current one (v1.01) allows that thingy. :)

Link: Download

-Cheers
#2109
vel: Reading Trapezoid's message I just realized we probably misunderstand each other. I assuming you was talking about AGS objects and their ability to hold interactions. If you just need sprites scrolling at different speeds then yes you can do it with the plugin.
#2110
QuoteNo, when you add the object, there would be a "Scrolling speed" button, which  would differ from 0% to 200%.
but what if it is moving also? ( MoveObject() )
#2111
Oh, sorry CJ I just have figured out it returns "...the old value of the setting." I need to read the manual more attentively next time. hehe ;D

-Cheers
#2112
Can you post the script?
#2113
Quotethink i am getting my head around the scripting
Glad to hear. it's really not difficult to script things in AGS.

Quoteas i am using the right button as use, the i suppose a right click on an inventory item should select it, left click while the item is active will unselect and right clicking with the item selected will attempted to use that item at the point of the click.

a left click on an inventory item will look at the item also.
Okey, first of all you want a different way of handling the inventory clicks than AGS processes internally. So you need to go to the game options and check Handle inventory clicks in script. This way you'll be able to handle them for yourself. If you look in the manual about that option than you'll find that with that mode turned on the on_mouse_click() function may recieve two additional values: LEFTINV and RIGHTINV. These values are passed in when you perform left/right clicks over the inventory window (to be more precise over the inventory items). Thereby LEFTINV should cause to look at the inventory item whereas the RIGHTINV should select it. The game.inv_activated variable maybe used along with LEFTINV/RIGHTINV to determine what inventory item player has clicked on.
As about unselection item or using it on some object the usual LEFT/RIGHT values need to be used as well. Ok, a bit of changes to on_mouse_click() then:


function on_mouse_click(int button) {
 // called when a mouse button is clicked. button is either LEFT or RIGHT
 if (IsGamePaused() == 1) {
   // Game is paused, so do nothing (ie. don't allow mouse click)
 }
 else if (button==LEFT) {
    // if player has an item then unselect:
    if (character[GetPlayerCharacter()].activeinv != -1) SetActiveInventory(-1);
    // otherwise process look or walk:
    else ProcessClickSpecial(mouse.x, mouse.y, MODE_LOOK, MODE_WALK);
 }  
 else if (button==RIGHT) {
    // if player has an item then try to use it:
    if (character[GetPlayerCharacter()].activeinv != -1)
         ProcessClickSpecial(mouse.x, mouse.y, MODE_USEINV,  MODE_WALK);
    // otherwise just interact as usual:
    else ProcessClickSpecial(mouse.x, mouse.y, MODE_USE,     MODE_WALK);
 }

 // handling inventory clicks: (Handle inventory clicks in script must be on!)
 else if (button==RIGHTINV) { //for right inv. click:
    // select the item  player has clicked on
    SetActiveInventory(game.inv_activated);
 }
 else if (button==LEFTINV) { //for left inv. click:
    // run look at inventory interaction
    RunInventoryInteraction (game.inv_activated, MODE_LOOK);
 }

}


Oh, there is SetInvDimensions (int width, int height) function which may help to optimize inventory item's slot area. Very useful to play with a bit as it actually sets the size of each inventory slot. Sometimes it's difficult to select an item because it's sprite size less than the slot size. See manual for details on that function.



ok. that's all for now. ask any questions you have and btw welcome to AGS forums. ;)

-Cheers
#2114
The problem it's not evident how it supposed to work. Imagine you have a scrolling object but that means it has to has variable co-ordinates. Or at least the real co-ordinates do not match the visible ones. Then what to do with functions like GetObjectAt() or SetObjectPosition() for example? I mean how to handle such objects? I think to implement this feature one have to re-organize AGS co-ordinate system. We nead X,Y and Depth charactiristics or X,Y,Z. The same for characters, their collisions etc.
I agree it may be great to use it in the particular case like intros but implementing it into AGS IMHO would be cost amount of work for CJ.

What I can do is to implement two functions into the parallex plugin:
GetSpriteX() and GetSpriteY(). And also a function that adds the sprite but doesn't show it on the screen. Instead you could use GetSpriteX(),  GetSpriteY() to place objects:

room_repeatedly() {

 SetObjectPosition( obj, GetSpriteX(), GetSpriteY() );
 ....
 ...
 etc.

}

thereby you can align all objects you need.

-Cheers
#2115
Quotei still have a few problems, yes i have read the manual but i only started this thing two days ago so you cant expect me to pick everything up at once
The best way to study is just to keep trying. ;)

Quote
function unhandled_event(int button) {
  if (IsGamePaused() ==1) {}
 
 
  else if (button==RIGHT) {ProcessClick(mouse.x, mouse.y, MODE_WALK);}
Such function won't work because it has to has two parameters: unhandled_event(int what, int type).
And the first parameter doesn't represent a button. See manual for details.


Ok, now to your problem.
Quotebasically i want to have a the player right click on an area if its an object that can be used it will be used, so say a tv in a room the player will turn it on, if the left click they will look at the object, ie "its a tv, 157 channels and nothing on" ok, if the object/hotspot cannot be used then the character will walk to that area unless obvisouly if its not in a walkable area.
Actually to implement it you do not need unhandled_event() function. To accomplish this you have to write a special process click function instead:

//Global script:

function ProcessClickSpecial(int x, int y, int cursor_mode, int default_mode) {
  if (IsInteractionAvailable(x, y, cursor_mode)) ProcessClick(x, y, cursor_mode);
  else ProcessClick(x, y, default_mode);
}

What does it do? When you call it it checks whether the interaction at specified co-ordinates is available. If it is then it process with cursor_mode, if not then with default_mode.

The function is ready and all we need now is to tune on_mouse_click() one:

function on_mouse_click(int button) {
 // called when a mouse button is clicked. button is either LEFT or RIGHT
 if (IsGamePaused() == 1) {
   // Game is paused, so do nothing (ie. don't allow mouse click)
 }
 else if (button==LEFT) {
    ProcessClickSpecial(mouse.x, mouse.y, MODE_LOOK, MODE_WALK);
 }  
 else if (button==RIGHT) {
    ProcessClickSpecial(mouse.x, mouse.y, MODE_USE, MODE_WALK);
 }
}

You see when there is an interaction then the frist mode is used. Otherwise the second.


As about inventory clicks what should happen when the player has choosen the item from the inventory?
Does the cursor represent the item then? How you suppose to return the cursor to normal state?

-Cheers
#2116
Dorcan: Aha, thanks for letting me know. Maybe such effect because it's called two times. One inside the on_event() function and another by AGS internally.

QuoteIn order to use the button while on inv guis you have to check the 'handle inventory clicks in script' nad use the 'LEFTINV' and 'RIGHTINV' buttons in the script
Spyros: That is, but the on_mouse_click() is called (with LEFT/RIGHTINV values) only if you have clicked some inventory item inside the inv window.

-Cheers
#2117
Hmm, yes seems like on_mouse_click() isn't get called at all provided you click on any GUI element except inventory window (if handle inv clicks is checked). Then you could use on_event() function with GUI_MDOWN, GUI_MUP events, as Dorcan correctly pointed out. Or handle right click inside the repeatedly_execute() function, example:


int rbutton_pressed = 0;
function repeatedly_execute() {


 if (IsButtonDown(RIGHT)) {
   if (rbutton_pressed == 0) {
      SetNextCursorMode();
      rbutton_pressed = 1;
   }
 }
 else rbutton_pressed = 0;


}


The rbutton_pressed is needed to avoid repeatedly cycling when you hold the right button.

Also don't forget to remove the SetNextCursorMode(); line inside on_mouse_click() or you'll jump over the two cursor modes instead.


Btw, Dorcan, why the interface_click() name is changed? I mean capital letters. I had heard you said it isn't get called properly or something. Just curious. :P

-Cheers
#2118
It's because if you have a script-only GUI the game become paused when that GUI is on. If you look at the on_mouse_click() function you see that you can't cycle modes if the game is being paused:

function on_mouse_click(int button) {
 if (IsGamePaused() == 1) {
   // Game is paused, so do nothing (ie. don't allow mouse click)
 }
 else if (button==LEFT) {
     ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else {   // right-click, so cycle cursor
     SetNextCursorMode();
 }
}


so you need to rewrite it a bit:


function on_mouse_click(int button) {
 if (IsGamePaused() == 1) {
   // Game is paused, so do nothing
 }
 else if (button==LEFT) {
     ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }

 if (button==RIGHT) SetNextCursorMode();

}

now it should work

-Cheers
#2119
Hey, great idea. :)

I've gotten interested in. At first I wanted to post a scipt but it's not evident how to use it without a GUI demonstration. So I made a saxophone template. Yep, it uses a GUI to show notes (signs). Well actually it doesn't play anything because I haven't suitable sound files right now. To assign a sound file open global script and find:


....
//Specify appropriate sound files here. They would be played as PlaySound(<sound_number>);
//======= Sound names === Files =====
#define SAX_SOUND_CTRL      1
#define SAX_SOUND_UP        2
#define SAX_SOUND_RIGHT     3
#define SAX_SOUND_DOWN      4
#define SAX_SOUND_LEFT      5
....


these lines. Next replace the numbers above to your values depending on numbers of you sound files.

There is a Noteline string variable to help recognize the tunes. It records all notes so you can check it in repeatedly:
if ( StrComp(Noteline, "CUDLC") == 0 ) Display ("Tada!!!");
will display the message "Tada!!!" provided the player has played: CTRL, UP, DOWN, LEFT, CTRL. (seems like MortalKombat special moves hehe ;D)


Hope this helps. ;)

Link: Saxophone template v1.0 AGS2.55beta4 required.

PS Let me know how it works and ask questions if any.

-Cheers
#2120
Advanced Technical Forum / Re:GUi's
Thu 15/05/2003 11:51:08
You should make a main GUI with a button (suppose it's name GUIMAIN and the number of button is 1), then choose button's properties and select Left Click: Run script. Now make another GUI: GUISUB (let's button number is 0). Don't forget to select Left Click: Run script too. Then inside interface_click() function add something like this:

//get called when a player has clicked on a GUI
function interface_click (int interface, int button) {

 if (interface == GUIMAIN) { //if player clicked on the MAIN GUI then...
    if (button == 1) { //if it was button 1 of that GUI he has clicked on
       GUIOn(GUISUB); //then show another gui
    }
   
 }
 
 else  if (interface == GUISUB) { //if player clicked on the SUB GUI then...
    if (button == 0) { //if it was button number 0 then...
      GUIOff(GUISUB); //close SUB GUI
    }

 }


}


that should work ;)

-Cheers
SMF spam blocked by CleanTalk