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

#1
Right, that's smart :)
I leave the topic opened, maybe someone will have some coding solution too.
#2
Quote from: VampireWombat on Wed 22/05/2019 13:18:19
You're welcome and good luck. My coding is probably bad enough to make a programmer cry. But it should accomplish what you seem to want.

Edit: I just remembered why I always had to click the object a second time. To be able to only click it once and then click the verb using this method would require putting the object code under the Verb buttons in the Global Script.

Here's a revised version. It only uses one Int variable, ObjectNumber. The downside to it is that it does the same thing to any object in any room with the number...

Hi VampireWombat !
I tried your code and it is working quite exactly like I wanted. Thank you very much !
I used only one globale variable object_selected, as a String and I do :

Code: ags

function oTV_Interact()
{
gVerbs.X = mouse.x;
gVerbs.Y = mouse.y;
gVerbs.Visible=true;
object_selected= "TV";
}


Then you only have to check this variable in the Button1_OnClick function. I agree that there is probably a more efficient way to do it but for now it will do the trick !
By any chance, do you know if it possible to prevent any player action (click on another object, on hotspot or just walk) while the GUI is opened ?
#3
Quote from: Crimson Wizard on Tue 21/05/2019 21:40:27
Quote from: PaulineV on Tue 21/05/2019 13:10:52
When I tried the Drag and Drop module, I used room objects so I thought I was in the situation "moves the actual object on screen at real-time" so I didn't need the GhostGUI.
Apparently I did not understand quite well this module, I am very new to AGS coding and this seems huge !  :-D

There are 3 modes:
- move object itself
- move its image on GUI
- move its image on Overlay

DragDropCommon.DragMove property sets current mode.

But it is still possible that the module has mistake, or documentation is not clear enough. So please tell whether you managed to use it in the end.

I cleaned everything which was about drag and drop attempts in my code and I took exemple on one of the rooms in the demo game : works perfectly !  ;-D
#4
Quote from: VampireWombat on Wed 22/05/2019 13:02:44
Oops. I meant click on the object again. And actually, that part can be bypassed by using another string variable.
I'm sure there's a way to simplify things using structs or creating a new function or something, but I haven't gotten into those yet.
The Global String Variables are Action, Action2, and ObjectName.
Here's sample code for the display GUI. You could use the default one and just change the name.

Wow, thank you very much for your help !
I will try that approach and to adapt it to my game. If I find something to simplify it, I'll let you know !
#5
Quote from: VampireWombat on Wed 22/05/2019 00:14:26
I've done this before, actually. The problem is that the method I used meant having to click on the object to make the GUI appear, click on the action, and then click on the action again.
The GUI was positioned based on where the mouse was when clicked and used a String variable.

I'm sure there's a cleaner way to do it. But if you still want to do it built on the BASS system, I can provide some sample code.

That's pretty much what I want to do, except for the "and then click on the action again"  :-D.
I managed to make a GUI appear exactly where the mouse is click but now I am stuck for what to do next.

Quote from: morganw on Wed 22/05/2019 00:29:32
There is a replacement for the current VerbCoin template that sounds a little like what you are asking for. I don't think many people have tried it, but you can download it from here if you want to give it a try. Maybe it will just be useful as an example of a context-sensitive GUI that pops-up, but the inventory system is pretty much the BASS one and I tried to keep it as simple as I could.

There also some basic instructions for it in the new manual:
https://adventuregamestudio.github.io/ags-manual/TemplateVerbcoin.html

Disclaimer: both of these items are effectively pre-release

Thanks morganw, il will look at it. The reason I thought templates were not the good solution is that they have a different system for inventory and I don't want to change the one I already have.
#6
Hi !
I was wondering if there is any simple way (existing module or simple code) to add a 4-verbs-like system into a BASS template.
What I would like is to create a GUI with 4 icons/GuiButton (for 4 actions) : done
I would like that GUI to open when player clicks on an object and, according to the GUIbutton selected, run a specific action.

The 4 Verbs template was not the best option because I want this to happen only in specific conditions.

Thank you very much in advance !
#7
When I tried the Drag and Drop module, I used room objects so I thought I was in the situation "moves the actual object on screen at real-time" so I didn't need the GhostGUI.
Apparently I did not understand quite well this module, I am very new to AGS coding and this seems huge !  :-D

For my purpose, I think that a transparent room with one object for each paper is a better solution than the one I presented before (with GUI and GUIButtons). Indeed, because papers are on top of each other and in different rotation, it seems that GuiButtons are not appopriate because it allows to click on the part of the button where there is no image (the button still have a squared delimitation).

I will try the Demo Game of the Drag and Drop module and try to implement it.

Thank you to the three of you !

#8
Yeah, I previously tried the Drag and Drop module for objects in a room but I kept having the following issue :

this.GhostGUI.BackgroundGraphic = slot;
Error running function 'repeatedly_execute_always':
Error: Null pointer referenced

So this is why I tried to do it another way  ;-D
#9
Hi AGS community !

I am creating a game where a woman is looking for an important information in her flat.
In one of the room, there is a pile of papers. When the charcter interacts with it, a GUI opens. Each one of the paper is a Gui Button. My intention is that the player can drag and drop the papers in order to find the good one with the correct information.

My code is mainly inspired from this post : https://www.adventuregamestudio.co.uk/forums/index.php?topic=50909.0

Here is my code, adapted :

Code: ags

bool WasDragging;
int OldMyItemX;
int OldMyItemY;
int DragOffsetX;
int DragOffsetY;

function repeatedly_execute() 
{
if (mouse.IsButtonDown(eMouseLeft)) {
        // have we pressed a button over our object?
        GUIControl *theGuiB = GUIControl.GetAtScreenXY(mouse.x, mouse.y); 
        if (!WasDragging && (theGuiB == b_Papier1 || theGuiB == b_Papier2)) {
            // just started draggin? remember where you took it
            OldMyItemX = theGuiB.X;
            OldMyItemY = theGuiB.Y;
            DragOffsetX = mouse.x - theGuiB.X; 
            DragOffsetY = mouse.y - theGuiB.Y; 
            WasDragging = true;
        }
        else if (WasDragging) {
            // mouse button still pressed? continue dragging
            theGuiB.X = mouse.x - DragOffsetX;
            theGuiB.Y = mouse.y - DragOffsetY;
        }
    } else if (WasDragging) {
        // was dragging but mouse button now released? drop it
        WasDragging = false;
    }
  }
}


I did it with only two papers for now, b_Paper1 and b_Paper2. It is working quite nicely exept from the situation where I go over a paper when I'm dragging the other one. It automatically switches to a dragging of the other paper.

If someone has an idea, it would be great !
Thanks in advance !
SMF spam blocked by CleanTalk