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

Topics - FanOfHumor

#1
Is there a way to change the pitch of a sound in AGS through script?
#2
I have  some script that runs if an object exists in the room but I get a "invalid object specified" error.
Code: ags

function on_event (EventType event, int data)
{
	if(event==eEventEnterRoomBeforeFadein)
	{
		if(version==0)
		{
			Room.SetProperty("versionnumber", 0);
		}

		
		

		
	}	
}	
int remtime;
// called on every game cycle, even when the game is blocked
function repeatedly_execute_always()
{	
	if(Room.GetProperty("versionnumber")==0)
	{
		if(object[0]!=null&&object[1]!=null)
		{
			object[0].Visible=true;
			object[1].Visible=true;
		}	
		if(object[2]!=null&&object[3]!=null)
		{
			object[2].Visible=false;
			object[3].Visible=false;
		}			
		
	}	
	if(Room.GetProperty("versionnumber")==1)
	{
		if(object[0]!=null&&object[1]!=null)
		{
			object[0].Visible=false;
			object[1].Visible=false;
		}	
		if(object[2]!=null&&object[3]!=null)
		{
			object[2].Visible=true;
			object[3].Visible=true;
		}			
	}	
	
	
	
	
	
	
	
	
	
	
	
	
	
	Object* o=Object.GetAtScreenXY(mouse.x, mouse.y);
	if(o!=null&&mouse.IsButtonDown(eMouseLeft))
	{
		o.Graphic=15;
		o.Graphic=16;
		GiveScore(-1);
	}	
	
}

How can I check if an object exists in the room?
#3
I have a script that places tiles on the room at the mouse pos when you click but it gets off set because the screen coordinates are different than room coordinates.How would you get the xy position of the room underneath the cursor?
Code: ags

function game_start()
{
	tileguide=Overlay.CreateGraphical(player.x, player.y,3);
}
function repeatedly_execute_always()
{

	
	
	if(beforetilenum<100000)
	{
		beforetilenum+=1;
	}	
	if(beforetilenum==100000)
	{
		beforetilenum=0;
	}	
	if(tile[beforetilenum]==null)
	{
		tilenum=beforetilenum;
	}	
	
	
	
	
	
	if(tileguide.Y<mouse.y&ileguide.X<mouse.x)
  {
    //bottom right
		
    tileguide.X+=60;
    tileguide.Y+=30;
  }  
  if(tileguide.Y>mouse.y&ileguide.X>mouse.x)
  {
    //topleft
    tileguide.X-=60;
    tileguide.Y-=30;
  }  
  
  if(tileguide.Y<mouse.y&ileguide.X>mouse.x)
  {
    //bottomleft
    tileguide.X-=60;
    tileguide.Y+=30;
		
  }    

  if(tileguide.Y>mouse.y&ileguide.X<mouse.x)
  {
    //top right
    tileguide.X+=60;
    tileguide.Y-=30;
		
  }  
	int dfg=3;
	if(mouse.IsButtonDown(eMouseLeft))
	{
	
		tile[tilenum]=Overlay.CreateRoomGraphical(tileguide.X, tileguide.Y, dfg);
		File* tilemap;
		tilemap=File.Open("tilemap.txt", eFileAppend);
		String s;
		s=String.Format("tile[tilenum]=Overlay.CreateRoomGraphical(%d,%d,%d);",tileguide.X, tileguide.Y, dfg);
		tilemap.WriteRawLine(s);
		tilemap.Close();
	}	
	
	
	
	
	
	
 if(IsKeyPressed(eKeyRightArrow))
  {
    Game.Camera.X+=13;
  }  
  if(IsKeyPressed(eKeyLeftArrow))
  {
    Game.Camera.X-=13;
  }  
  if(IsKeyPressed(eKeyUpArrow))
  {
    Game.Camera.Y-=13;
  }  
  if(IsKeyPressed(eKeyDownArrow))
  {
    Game.Camera.Y+=13;
  }  
}	

The tileguide should be in the same place as the cursor but it should be able to send xy room position of tileguide to tile[tilenum].
Any thoughts on how to do this?
#4
I have raw script that I put into a txt file for opening in another ags game and I need to run that script or move it to somewhere in the game script to be run.Can this be done?
#5
I have this global integer array  that I want to add to each always but whenever I place this in any other repeatedly execute that is not in a room it doesn't do anything.I have tried putting it in a script at the top of the script list.
    timer[0]+=1;
  timer[1]+=1;
  timer[2]+=1;
  timer[3]+=1;
  timer[4]+=1;
  timer[5]+=1;
  timer[6]+=1;
  timer[7]+=1;
  timer[8]+=1;
  timer[9]+=1;
#6
It seems like i've heard somewhere of how to to this but I can't remember where.All I need is to allow showing the quotes in this.
output.WriteRawLine("script1="king01.txt" run=1");
#7
Is it possible to write to a file without these char  surrounding these numbers.

CreateObject pos=    354    ;     382     dir=0.0 type=Bot3 


I'm fine with  being at the end but the others are a problem.
#8
Ok so I never really figured this out and when I tried it recently I couldn't figure out how to say which file to open.I would like to be able to open from game-windows directory if possible but I see your not able to write to the file and only able to read it.
Code: ags

{
	if(mouse.IsButtonDown(eMouseLeft))
	{
		if(mouse.Mode==eModemcar)
		{
			car=Overlay.CreateRoomGraphical(mouse.x, mouse.y, 2);
		}	
		if(mouse.Mode==eModemblupi)
		{
			other[othernum]=Overlay.CreateRoomGraphical(mouse.x, mouse.y, 4);
			File* newfile=File.Open("scene031",eFileWrite);
			
			newfile.WriteString("TESTING TESTING TESTING");
			newfile.Close();
			
		}	
	}	
}

Where should I place the txt file?
#9
As the title says I'm asking if you could please add Overlay.GetatScreenXY if possible.
#10
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?
#11
It seems that I am going to be asking many simple questions that don't deserve a topic.So I thought I could just ask them here whenever I need to.


So the first question is:
Is there a way to create an animation and then delete it once its finished.I tried using overlays and dynamicsprites but those don't work as well as objects. I heard somewhere that you can't delete objects.So is there another way?
Second question:
Does the mere existence of an object in a room effect game speed at all? Even if its not visible?
#12
I'm having trouble with using callroomscript when calling a function that has integers in it.

I get  errors when trying to call animateoverlay().
Code: ags

function animateoverlay(Overlay* selectedoverlay, int Xposition, int Yposition, int startsprite,int endsprite,  int transparent, int repeatoronce)
{
	selectedoverlay=Overlay.CreateGraphical(Xposition, Yposition, startsprite,transparent);
	selectedoverlay.Remove();
	startsprite+=1;
	if(startsprite!=endsprite)
	{
	      CallRoomScript(animateoverlay(Overlay* selectedoverlay,int Xposition,int Yposition,int startsprite,int endsprite,int transparent,int repeatoronce));
	}	
	else
	{
		if(repeatoronce==repeat)
		{
		  startsprite=0;
		}	
		if(repeatoronce==once)
		{
		  selectedoverlay.Remove();
		}		
	}

At first I tried a simple CallRoomScript(animateoverlay());
But it wasn't enough parameters.
Then I tried CallRoomScript(animateoverlay(Overlay* selectedoverlay,int Xposition,int Yposition,int startsprite,int endsprite,int transparent,int repeatoronce)); ,but it had a parse error in expression near int. 
What am I doing wrong.

Also does anyone know a better way of animating overlays?

Thanks.
#13
Just what the title asks.
Thanks in advance.
#14
Well before I didn't think about asking this crazy question because it seemed unreasonable but I suppose it couldn't hurt to ask so anyways.Could a port of ags be made for nintendo wii?At this moment there are only two gui wii game studios called "Titan ide" and "Wii Game Studio".Wii game studio pretty much is too much out of date to work and titan ide is mainly for making platformers. They both use devkitpro. The libraries for developing a wii game are available at a couple websites but that is very challenging.So what do you say? Is it within reason or a stupid idea?
#15
Can someone give me a link to monoags as built for windows.I just wan't to try monoags I dont want to go through installing visual studio just to try it.If someone could make a temporary link for me i'd appreciate it.
#16
I have a button that displays an inventory item in my custom inventory. I don't have an inventory window but instead I have buttons in place of where the inventory items should be placed.Its really hard to explain so i'll try explaining with pictures.

I have a button for interactions.

and an inventory item for receiving the actions as events.

I want the inventory item to recognize events
from the buttons interactions.(As if The inv-item was clicked instead of the object)

if ikey(the button) has an item used on it then ikey2(inv-item) should recognize it as .
And so on with the other events.
I hope I explained it clear enough.
Thanks in advance.
#17
I just started using .tiff images recently because tiff is 2x faster loading than png.When I import it I have to rename it as just .tif.This is troublesome since converters to tif aren't as common as tiff converters.Could support be added for tiff please?
#18
I have an AGS game that I am making at 1080p but its slightly slow.Just recently a friend of mine(A professional graphics artist) said that I should do it in 4k RGBA16 so that it could be scaled down and have no problems scaling up.He says that exporting it as RGB16 will be smaller in file size so I don't know if doing it in 4k is better for speed or not.What exactly effects the speed of AGS games?Would it be the graphics resolution,the filesize of the graphics,the amount of animations running at once,or something else? If the resolution of the game is scaled down to the users screen size would that make it run faster?And does using RGB16 effect the speed in any major way?

EDIT:
Apparently no one is able to answer these questions but I would at least like to have this one question answered if possible.When an AGS game loads sprites what is the most speed effecting part of loading it?Is it the file size(as in bytes) or the file size(as in resolution size)?
#19
I would like to be able to have a small script to change the cursor to normal whenever its over any object and the object is animating.If it isn't animating to then change the mouse mode to whatever I choose.
This is the script I use to change it whenever it's animating. This is in a rooms repeatedly execute function.
Code: ags
	
if(Hotspot.GetAtRoomXY(mouse.x, mouse.y)==hHotspot1)
	{
			if(fries2.Animating||fries.Animating)
		{ 
			mouse.Mode=eModeWalkto;
		}
		else
		{
			mouse.SaveCursorUntilItLeaves();
			mouse.Mode=eModeclickable;
		}  
	}

What I would like to do is to check if any object is animating+mouse is on it.
What I have tried is this in Global Script in repeatedly execute always. I stopped short because I couldn't think of anything that could possibly work.
Code: ags

  if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter||GetLocationType(mouse.x, mouse.y) == eLocationObject && \\I thought maybe something here to set the condition of animating.)
  {
     if(__//any object that the mouse is over__.animating==true)
     {
        mouse.SaveCursorUntilItLeaves();
        mouse.Mode=eModeclickable;
     }
  }


So basically it should check what object the mouse is on and then check if that object is animating.

EDIT:

If no one knows please say so.
#20
I don't know anything about how SVG works so I have no idea whether it's plausible or not to import SVG images as sprites into AGS.Ive been learning to make svg recently and I thought"I wonder what it would be like if AGS could import SVG?I'm guessing it would be smooth for even small resolutions.". Would it? Is this possible or just wishful thinking?
SMF spam blocked by CleanTalk