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 - Crimson Wizard

#2941
Quote from: chip on Sun 29/05/2022 15:19:13
If I spawn directly into this room, via character starting room, the mouse cursor is visible and the gamecontrols work as intended. The problem only occurs when I run the game from start, with several rooms before this, as the game intro.
The intro-code is always in "room_FirstLoad" and it contains a mouse.visible = true; at the end, but its still invisible and has no effects on any clicks everywhere

First thing always is to make sure the function is run. Double check that the room_FirstLoad is actually connected to the corresponding event in room properties. You may also put "Display("hello")" there and see if message appears.
#2942
Quote from: Amir on Sun 29/05/2022 06:04:02
Yes, with obj.X and Y I’m getting the problem null pointer referenced.
Is there no solution to this before I try the module?

Like I mentioned, for the correct results you should also remember the dragged object in a variable when the dragging starts, and use that here instead of local "obj" instead.
It should probably be like:
Code: ags

bool WasDragging;
int OldMyItemX;
int OldMyItemY;
Object *DraggedObj;
function repeatedly_execute()
{
  if ((mouse.IsButtonDown(eMouseLeft)) && (cBerny.Room == 22))
  {
        Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
        // have we pressed a button over our object?
        if ((obj != null) && (!WasDragging))
        {
            // just started draggin? remember where you took it
            OldMyItemX = obj.X;
            OldMyItemY = obj.Y;
            DraggedObj = obj;
            WasDragging = true;
        }
        else if (WasDragging) 
        {
            // mouse button still pressed? continue dragging
            DraggedObj.X = mouse.x;
            DraggedObj.Y = mouse.y;
        }
    }
    else if (WasDragging)  
    {
       // was dragging but mouse button now released? drop it
       WasDragging = false;
       DraggedObj = null;
    }  
}




Actually, in this case WasDragging may perhaps be omited and DraggedObj used instead in conditions. A cleaner version of the code would look like:

Code: ags

Object *DraggedObj;
int OldPosX; 
int OldPosY;

function repeatedly_execute()
{
    if ((mouse.IsButtonDown(eMouseLeft)) && (cBerny.Room == 22))
    {
        // was not dragging yet?
        if (DraggedObj == null)
        {
            // have we pressed a button over some object?
            Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
            if (obj != null)
            {
                // just started draggin? remember what and where you hooked up
                OldPosX = obj.X;
                OldPosY = obj.Y;
                DraggedObj = obj;
            }
        }
        else if (DraggedObj != null) 
        {
            // mouse button still pressed? continue dragging
            DraggedObj.X = mouse.x;
            DraggedObj.Y = mouse.y;
        }
    }
    else if (DraggedObj != null)  
    {
       // was dragging but mouse button now released? drop it
       DraggedObj = null;
    }  
}
#2943
Code: ags
nouvelle=s.Substring(r, rr-r); // Error indicates : String.Substring : invalid length


So it fails at Substring?

I tested your code with random "n" to trigger "if (c==n)" condition, and there was no errors. I guess "n" means a line. Could you tell at which "n" it happens, does it occur at any or particular lines?

I need to narrow the situation down to know which exactly conditions cause this error.

EDIT: actually, I ran this code in a loop, from n = 0 to 500, and met no error... tried in both ASCII and UTF-8 mode.
#2944
Quote from: Amir on Sun 29/05/2022 01:04:30But the code doesn't work.
I think you pasted the code incorrectly, this part seem wrong:
Code: ags

            // mouse button still pressed? continue dragging
            OldMyItemX = mouse.x;
            OldMyItemY = mouse.y;

should be
Code: ags

            // mouse button still pressed? continue dragging
            obj.X = mouse.x;
            obj.Y = mouse.y;


For the correct results you should also remember the dragged object in a variable when the dragging starts, and use that here instead of local "obj" instead, because if player moves mouse too fast, the cursor will appear no over the dragged object and local "obj" will be null.

By the way, this code assumes non-scrolling room, where screen coordinates match room coordinates.


On a side note, have you tried the Drag & Drop module? It already has all the functionality:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=53332.0
#2945
Quote from: Baguettator on Sat 28/05/2022 16:41:17
I just tried the new version (beta 5), and I tried to change the text format in the general settings pannel : I switched from ANSII to UTF-8. As I'm french, with special characters like éàÉÈ I thought it was better do to that. But when I change the format, the game crashes during a function that "reads" some txt files. It seems the txt files can't be read, so the functions like ReadRawLineBack return an empty string (so it crashes in my function). These txt files are in UTF-8 format.

I made a new test game in UTF-8 format, and tried your file, and it worked well. Please post a script that crashes?

Here's a simple script i used:
Code: ags

function room_AfterFadeIn()
{
	File *f = File.Open("test.txt",eFileRead);
	if (f == null) return;
	while (!f.EOF) {
		String s = f.ReadRawLineBack();
		Display("%s", s);
	}
}
#2946
Quote from: AndreasBlack on Mon 23/05/2022 21:56:33
Edit: a Question. So my game is 320x200 and i used the "render sprites at screen resolution" option, but that seems to not be happening. When my character looks like quasimodo in the face, it's quite obvious somethings gone bad  (laugh) Am i missing something? Anti-alias sprites perhaps?

Please, could you be more specific, what is "not happening"? What do you expect, what happens in reality? Does "it" happen on desktop PC? How do you set the config on android?
#2947
Well, I have to say that currently I don't understand the problem at all.
Camera is in room coordinates, it tells which part of the room is currently visible. Viewport is in screen coordinates and tells where on screen the room is displayed. Character walks in room coordinates (like camera).

Why do you have to guess where your floors are located using camera or viewport anyway? Are not you are the one who draws the room? You should know their coordinates...

Perhaps if you could post a screenshot and mark the location your are trying to find out?
#2948
You can read Game.Camera.X and Y properties, and you may handle Ctrl+D in on_key_press, or even print that on a label in e.g. repeatedly_execute_always.

Or, if you want to find out the room coordinates under the middle of the screen, then it will be Camera.X + Camera.Width / 2 and Camera.Y + Camera.Height / 2 respectively.

Camera article in the manual: https://adventuregamestudio.github.io/ags-manual/Camera.html
#2949
About the Beta, I think we'll have another update soon, but because we haven't found any more critical bugs, and there are no more game features planned, we're taking time just doing less important fixes and improving some things.
#2950
Quote from: Pajama Sam on Thu 26/05/2022 19:15:15
I've been encountering an error" Undefined token overplay".Overplay is a function and is imported in overplay.ash but when I call it sometimes it works and sometimes it doesn't.I don't think theres anything wrong with how I placed the script although I could be wrong.I also encountered this same error for another function a few days ago.After a while it seemed to just fix itself with no changes done to it.
heres the .scm scripts
https://www.filemail.com/d/khuayqkknjpyaol

If this error happens during compilation, "Undefined token" means the script does not see the function. The usual case is that your module with function "overplay" is located below the module that tries to use it ("fishtank") in the list of modules. In AGS script modules can only see functions declared above them.
#2951
From the top bar:

Profile -> Forum Profile -> Show Posts (on the left bar)
#2952
Quote from: cat on Wed 25/05/2022 08:20:08
2) I included all audio files in the game which makes quite a big vox file and is somewhat impractical because I have to recompile the whole game to change the playlists. Is it possible to a) access audio files from the file system and b) play such files in AGS?

There's a deprecated PlayMP3File function that may be turned on by disabling "Enforcing new-style audio scripting". The problem with it will be that it returns a result rather than audio channel pointer, but if you have reserved limited number of music channels, then you may deduce its index and access as System.AudioChannels[n].

Also, AGS naturally supports loading any game resources from the filesystem, if they are present there. It's bit complicated with new audio clips system, because the files have to be called how they are called in AudioCache, using generated names instead of original names. That will also only work if you want to provide replacement for registered resources, otherwise there will be no way to run these.

Quote from: cat on Wed 25/05/2022 08:20:08
3) When you hold down the back button, a menu will appear. Is it possible to disable this menu? My kids will certainly open this by accident and then cause mayhem on my phone.

No, but if you build for Android in 3.6.0 Editor, it will create an individual APK which does not have this menu. Thinking about it, I don't know if reading files from the file system will work with that form of compiled game; but maybe worth checking out.

Alternatively, this may be a feature request for the universal game player in 3.6.0, perhaps it could have a config setting for disabling this menu.

Quote from: cat on Wed 25/05/2022 08:20:08
1) When I turn off the screen of my phone to save battery, the music stops as well. Is it possible to have this continue running?

I'd first try enabling multitasking mode in the game (SetMultitaskingMode), e.g. on desktop systems that keeps game running when they are switched out from. But if that won't work, that's a question of how port works in general.
#2953
I think it's worth mentioning that the template is merely a starting set of resources, including script, and everything may be changed later. It's possible to implement an individual control scheme for you game.
#2954
Quote from: Pajama Sam on Mon 23/05/2022 02:03:08
I want to be able to check if the mouse is over any overlay without using  objects,hotspots or regions.Is it possible to check accurately without having to tell the graphics dimensions?Can getlocationtype be used to check for an overlay at mouse position?

No, you will only be able to do this if you keep the pointer to overlay and test for its dimensions.
#2955
Quote from: martag on Sun 22/05/2022 21:47:42
2. Any tricks to remove the white arrow cursor?

Is this arrow cursor a part of the game? in such case you may hide the cursor either using Mouse.Visible property, or switching cursor graphics with a transparent 1x1 sprite. This may be done under condition that the game is run on Android, for example:
Code: ags

function game_start() {
    if (System.OS == eOSAndroid) {
        Mouse.Visible = false;
    }
}
#2956
Quote from: Amir on Sun 22/05/2022 13:34:15
Hi CW, guys,

Today I noticed 2 weird things, I don't know if these are bugs or normal.

Both are normal behavior.
1. SayBackground does not play voice clips. For non-blocking voice there's a new function Game.PlayVoiceClip since 3.5.0, which may be used in cobination with non-blocking speech text.
2. Rooms don't remember drawing on backgrounds and area states:
https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Room.html#removewalkablearea
#2957
Quote from: eri0o on Sat 21/05/2022 01:12:18
Btw, I don't know if Android Studio works on Windows 7 since I never used it there and the OS is unsupported by MS, so there's that too.

It worked for me last time I tried.
#2958
Quote from: selmiak on Sat 21/05/2022 00:01:23
linking a website works on windows, but when compiling I get this:

https://i.imgur.com/C40m3nR.png

even though the required file is in the AGS install directory. But not in the plugin part of the game project tree...

Everything is mentioned in the manual:
https://github.com/adventuregamestudio/ags-manual/wiki/Plugins
#2959
Quote from: Laura Hunt on Wed 18/05/2022 21:36:11
I think you're missing a null check. I haven't tested this, but maybe try something like this?

There's no need for a null check when you are comparing a pointer value.

Code: ags

  if (tempbutton != bBegin)


This will also cover null value, because if tempbutton is null, then it's already not equal to bBegin
#2960
Quote from: eri0o on Wed 18/05/2022 01:35:51
uhm... About overlays... How far off is adding tint to them?  (roll)

Alan Drake is demanding that i dont add anything to 3.6.0 anymore, so all the additions go into ags4 now.
Right now tinting may be added through dynamic sprite's Tint function.

Technically, tint is applied to a texture, so it's a matter of having a parameter in overlay. However, in regards to ags4, I'd rather suggest moving towards base class, where it will contain all the transform and color effects. Then one won't have to add separate parameters to each type of object.
SMF spam blocked by CleanTalk