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

#1
General Discussion / Quickdraw!
Wed 23/11/2016 21:29:06
Hey everyone

I know I haven't been very active in the forums recently; although I have been active on the great A Poison Green! :-D I've managed to take up work as a theatre techie alas, so spare time is hard to come by.

Anyway, If the mods will allow, I was wondering whether I could share a card game with y'all (designed by yours truly) and see if anyone is interested. It's basically a western 'quickdraw', where you take on a character and stare your opponent down in a final showdown, before you both go for your guns! A very short game where you try to outplay and second guess your opponent's every move!

Here's a link https://www.kickstarter.com/projects/itbboardgames/quickdraw-a-western-modular-microgame-for-2-outlaw

Thanks all :)
#2
Advanced Technical Forum / D3D9 Plugin Example
Thu 10/12/2015 11:45:21
Hello Everyone!

I hope this is the right forum to post this question, I apologise if not!

I know it's a bit cheeky to ask, but I was wondering whether anyone could share a simple plugin script that uses the d3d9 driver; I have found the Microsoft resources quite helpful, but am unsure specifically how to get my code to interact with AGS's d3d9 rendered objects (If I am understanding it correctly)

I'm sorry if this post is short, I am late for something at the moment :P

Thanks very much!
#3
Hello Everyone!

I'm speculatively creating a kind of lighting system, although it will probably be very slow and useless. Still, the idea is that the user can create an area which contains a certain colour and a certain saturation (the saturation changes depending how far the pixel is away from the light source). The complex part is that it is possible for only part of a character or object to be lit up, depending on which pixels overlap. Therefore, the relevant parts of the character are transferred over to a DrawingSurface to be tinted. So far so good. However, I don't want to use a DynamicSprite to Tint the whole image, because there are certain colours (i.e. Black) which I would like to be left alone due to stylistic reasons. I also don't want to use a dynamic sprite for every single pixel and tint that, as that seems like it holds an extra risk of further slowing things down. Is there a way to use the GetPixel() and SetPixel() Drawing Surface functions to combine the colours of both the original pixel and overlay tint, so that the original comes out tinted? I guess I'm referring to some kind of colour theory, which I don't know much about... :s

I know this is very speculative, and it'll probably be too slow anyway :P But thanks in advance! :)
#4
Advanced Technical Forum / Zooming Woes
Tue 05/11/2013 10:06:39
Hello Everyone!

I've been trying to come up with a way to zoom in and out of the background slowly (no problem) with any center point: so the user defines a point and the camera slowly zooms in/out to that point, as long as the image does not move out of the bounds of the screen, in which case the center point is adjusted. (again, no problems there) However, what I am struggling with is positioning of characters/objects in relation to the new 'center point'. I'll go through the theory first to see if that bit is wrong, and if not I'll post up what I've done so far.

The basic assumption I made was that, say, if the zoom level was 2x, the character/object would end up being twice as far away from the 'center point'. I'm using zoom levels 100% (normal) going upwards (so 300% is 3x zoomed in). Therefore, the end XY position of the character/object to the center point would be the initial X distance and Y distance (these distances are calculated on the assumption of a zoom level of 100%) multiplied by the zoom level (so 100% is 1, 150% is 1.5, 167.45% is 1.6745 etc.).

I also figured that as the 'center point' does NOT start at the center (usually), then it's trajectory to the center of the screen would be the point at which the XY of the character/object is calculated from.

So the process on each loop is:
1) Get the zoom level for this loop.
2) Create the new background frame from dynamic sprite (this works fine it seems)
3) Get the position of the 'center point' on it's trajectory to the middle of the screen.
4) Calculate the XY position of the character/object by multiplying the X distance and Y distance by the current zoom level and adding that to the XY value of the 'center point's new position.

It may be an implementation problem, it may even be that the background sprites aren't calculated correctly, but I just wanted to check if the theory was correct first before going further and posting a wall of code.

Thankyou very much for your time!
#5
I have the following code:
Code: AGS
//Header of script
AudioChannel *Channel[5];
//Body of script
void AddSound(AudioClip *clip, AudioPriority priority, RepeatStyle repeat, int volume){
  int i, transfer;
  while(i<5){
    if(Channel[i] == null){ transfer = i; i = 10;}
    i ++;
  }
  if(i!=11){ Display("Too many sounds!"); return;}
  Channel[transfer] = clip.Play(priority, repeat);
  Channel[transfer].Volume = volume;
}
void AddSoundAt(AudioClip *clip, AudioPriority priority, RepeatStyle repeat, int x, int y, int volume){
  int i, transfer;
  while(i<5){
    if(Channel[i] == null){ transfer = i; i = 10;}
    i ++;
  }
  if(i!=11){ Display("Too many sounds!"); return;}
  Channel[transfer] = clip.Play(priority, repeat);
  Channel[transfer].Volume = volume;
  Channel[transfer].SetRoomLocation(x, y);
}

then in Room_AfterFadeIn():
Code: AGS
 AddSound(aSound1, eAudioPriorityHigh, eRepeat, 100);
 AddSoundAt(aSound2, eAudioPriorityHigh, eRepeat, 2173, 412, 100);
 AddSoundAt(aSound3, eAudioPriorityHigh, eRepeat, 439, 421, 100);


  The weird thing is, only aSound3 is played. After further investigation, I discovered that the first 3 Channels (Channel[0] to Channel[2]) all have aSound3 as the sound they are playing.

  Annoyingly, the above used to work normaly, but after I replaced some sound files and modified the code like this:
Code: AGS
//Body
void CheckSoundsAreNotNull(){
  int i;
  while(i<5){
    if(Channel[i] != null){
      if(!Channel[i].IsPlaying) Channel[i] = null;
    }
    i++;
  }
}
void AddSound(AudioClip *clip, AudioPriority priority, RepeatStyle repeat, int volume){
  CheckSoundsAreNotNull();
  //same code as above
}
void AddSoundAt(AudioClip *clip, AudioPriority priority, RepeatStyle repeat, int x, int y, int volume){
  CheckSoundsAreNotNull();
  //same code as above
}

Seeing that only the last declared sound was playing, I reverted to the unmodified code, but it seemed the damage had been done and only Sound3 was playing?

Any ideas as to what could be causing this?

Thanks again!

UPDATE: just attempted this code in Room_AfterFadeIn() to replace the previous room code:
Code: AGS
 aSound1.Play();
 aSound2.Play();
 aSound3.Play();

it seems to have the same problem now...
#6
Hello Everyone!

Well, after this post, I decided to salvage everything and run by basically making an exact copy of the game bar the music files (since they were obsolete anyway for the project) and get a lovely uncorrupted experience. Unfortunately I receive an illegal exception error on start-up, which I read up can usually be found by commenting out sections of code until I hit what's causing the error.

So I set "check points" (basically, writing into a file, since Display("Blah") can't be used in certain functions) through what I figured would be the start-up procedure, that is:

game_start() (on all scripts)
on_event() (for eEventBeforeFadeIn)
room_Load() (for the room I'm starting in)
room_FirstLoad() (ditto)
room_AfterFadeIn() (ditto)

It appears that the error happens after the end of room_Load() but before room_FirstLoad() and room_AfterFadeIn() - does anyone know what the engine is loading up/executing at that point?

Thanks again!
#7
Hello Everyone!

I have encountered a curious error whereby my game crashes when it encounters the following code:
Code: AGS
sMenu = DynamicSprite.CreateFromScreenShot();
sMenu.Tint(0, 64, 128, 50, 75);


Where sMenu is a Dynamic Sprite. It is deleted at points, but whether it is deleted or not before the above usage comes in the game always freezes up and gives me a CrashInfo3.21.1115NMP.DMP file.

The exception information: "The thread tried to read or write to a virtual address for which it does not have the appropriate access"

However, this ONLY happens when I run the game from the .exe - in the editor this line executes fine and nothing goes wrong.

Also, as I said before, the game freezes, doesn't crash (actually managing to lock up mouse controls at one point). I have to open the .DMP file with VisualStudio C++ (although that may be my default programs taking over).

Does anyone know what could be causing this?

Thanks again!
#8
Beginners' Technical Questions / Zooming Maths
Sun 26/05/2013 21:03:39
Hello everyone!

I'm very sorry if this is a simple question to answer - my brain just seems a bit fuzzed today (I'm sure that's a verb)

I'm writing a zooming out function (from a zoomed in image of 50%) where the character is scaled and placed separately from the image. More precisely, I have 64 Dynamic Sprites where each contains a more "zoomed in" version of the background than the last, and a character who is animating separately with the proper scaling. I'm trying to have the character appear as if he is staying in the same place, but scale correctly. I tried, therefore, implementing this code:
Code: AGS

//somewhere above:
DynamicSprite Background[64];
//these then get assigned to the backgrounds at progressive level of "zoom" (63 = max zoom)
int i = 63;
float xFactor = IntToFloat(cChar.x-EndCharXPlace)/64.0; //where EndCharXPlace is where the character's final x coordinate should be
float yFactor = IntToFloat(cChar.y-EndCharYPlace)/64.0; //and so on...
float sFactor = IntToFloat(cChar.Scaling-EndCharScaling)/64.0; 
float j;
while(i >= 0){
  object[0].Graphic = Background[i].Graphic; //there are reasons why it's an object...I think...
  j = IntToFloat(i);
  cChar.Scaling = EndCharScaling+FloatToInt(j*sFactor, eRoundNearest);
  cChar.x = EndCharXPlace+FloatToInt(j*xFactor, eRoundNearest);
  cChar.y = EndCharYPlace+FloatToInt(j*yFactor, eRoundNearest);
  Wait(3);
  i --;
}

Whilst the character (cChar) starts and stops at the right X/Y coordinates and scaling, the character appears to move down and left on the screen (relative to where he should be) for the first 32 frames, before slowly returning back to end up at the correct position for the last 32. How can I correct the formula so the character moves the correct amount of X and Y to seemingly stay in the same position?

Apologies again if this is a waste of time - I feel like I should know the answer :\

Thanks again!
#9
Hello everyone!

*SPOILERS WARNING!* This discussion will be about perhaps the most spoiler-ish episode in recent DW history - DO NOT read on if you have not seen Series 7 Episode 13! (or series 33, in real terms :P)

Firstly: apologies if this is the wrong place to post - it's the first one I've done outside of the tech area!

I don't know how big a deal Doctor Who is outside of the UK - but man, that Finale!

The construction of the episode itself seemed to be almost bang on this time (it's been somewhat lacking this series) - while things like "dream worlds" and psychic links felt a bit trope-y (especially the bloody enemies which didn't make any sense), it felt like it was all leading to the moment we discover, if not all, at least a substantial part of the Doctor's mystery (and Clara's!)

I also found the way Moffat decided to create and sustain this mystery of Clara, and it's final explanation, much, much better executed than the whole Rory/Amy/Riversong storyline. This time the mystery didn't require a lot of exposition, but just enough to still create an intriguing, and intellectually satisfying ending.

That said, the recurring motifs I found still didn't work - the leaf is significant sure, but it feels out of place - we already know the delicacy of the situation, we don't need it to be shoved in like that - that's what actors are there to convey!

Speaking of which, I don't know what everyone thinks about this (I've heard varying opinions) but i really think this series has let Matt Smith really create his own, unique Doctor. The light, comic side to him no longer feels like it is the dominant one, with his serious side coming into effect. It seems a shame that now that he's truly carved a Doctor's niche for himself, that he will leave so soon.

However, the new Doctor - John Hurt I believe - looks incredibly interesting to take Matt Smith's place - simply in the contrast between the two. Certainly at the end, he seemed to be the Doctor's ultimate dark side, or dark secret. I've looked around and seen rumors that John Hurt may actually be something along the lines of the 9th Doctor, making Matt Smith the 12th, and final, one. It will be interesting to see how they write in a darker, more overtly troubled Doctor, especially if that's set just before or after the Time War!

Anyway - I'm curious to see what other people think of that Finale (and future of DW) - apologies again if this is not the right place to post :)
#10
Hello Everyone!
I have some code where characters talk in the background. Nothing fancy really, just have this setup:
Code: AGS
void Cut1(){
  Character *c;
  String m;
  if(Cut1Stage == 0){ m = "Some stuff"; c = cChar1;}
  else if(Cut1Stage == 1){ m = "Some Other stuff"; c = cChar2;}
  else if(Cut1Stage == 2){ m = "Even more!"; c = cChar1;}
  //etc etc.
  Cut1Stage ++;
  c.SayBackground(m);
  Cut1Timer = (m.Length/Game.TextReadingSpeed + 1) * GetGameSpeed();
}
 //Then in rep_exec_always():
function repeatedly_execute_always(){
  if(Cut1On && Cut1Timer > 0) Cut1Timer --; //if one is still talking, count down
  else if(Cut1On && Cut1Timer <= 0) Cut1(); //else get to the next bit
}

It all works fine left on it's own. The problem is when the player character says something (player.Say("blah")) it cuts off the character talking in the background (as in, they're speech completely disappears). Is there an option to change that, or is it supposed to be like that? Or (most likely) am I doing something wrong?

Thanks in advanced!
#11
Hello All!

I think there's a hidden (or possibly obvious, I just haven't seen it) rule to Dynamic Sprites which I'm not quite twigging. I wrote a piece of code that curiously refuses to work when exported to a game which has a 1024x768 resolution (it was written and tested in a 320x240 resolution) BUT if I export it into a 320x240 game, then increase the game's resolution to 1024x768, it somehow works! Although I did choose the option to change the size of the GUIs upon upgrading in size, that shouldn't make too much difference.
The code is:
Code: AGS
//At top:
DrawingSurface *d;
DynamicSprite *ss;
// Somewhere else
ss = DynamicSprite.Create(Room.Width, Room.Height, false);
//Then, called every cycle from repeatedly_execute_always (after the rain is moved and created)
void DrawRain(){
  d = ss.GetDrawingSurface();
  int i;
  if(CurrRaindrops > 0) d.Clear(); //This is to clear the drawing surface so no overlapping takes place
  while(i < MaxRaindrops){
    //blah blah
    d.DrawImage(rain[i].x, rain[i].y, sprites[i2].s[rain[i].Collided].Graphic); //Draws the right sprite onto the drawing surface (and therefore ss)
                                                                                //Variable i2 is defined within the loop
    i ++;
  }
  object[0].Graphic = ss.Graphic; //object 0 has a position of (0, Room.Height)
  d.Release(); //Cos it's good to do ^_^

The code works, but seemingly not when imported into a game of the size 1024x768 directly. Does anyone have any ideas? I know I can just start a new game at 320x240 and change the size from there, but I'd like to know what is causing this...
  Thanks again!
#12
Hey all!
I've been recently been playing around with with different dialog methods, and I have a question concerning a particular piece of code which I would like to use for efficiencies sake. Basically, each conversation stores it's options, and if any new ones need to be added the next time the conversation is opened the code should do that without losing the old ones. I've tried to do it this way:
//in room
Code: AGS

function hBody_Talk()
{
 CurrentDialog = 0;
 if(player.HasInventory(iPoster)) CreateNewOption(5, 24);
 if(player.HasInventory(iGun)) CreateNewOption(6, 29);
 StartDialog(0);
}

and global script
Code: AGS
function CreateNewOption(int index, int sprite){//Add a new index
  if(Game.DoOnceOnly(String.Format("&d,&d,&d", CurrentDialog, index, sprite))){
    //do all the adding dialog stuff
  }
}

Unfortunatly, the code only executes once, despite the string value in Game.DoOnceOnly being different. Have I misunderstood the nature of that function? I searched the forums prior and I found an earlier example using this sort of logic...
Thanks!
#13
Hey all! I searched this through the forums, but no-one seems to have this specific problem.

I'm fooling around with some RTS-ish style mechanics (purely for programming practice) and I noticed that solid characters seem to walk on top of each other. Every character is declared solid and has a blocking height and width of 50. However, when I ask them all to move to the same spot, they all hurry towards it and all move into that exact spot. Sometimes some will pause and then continue 1 by 1 as the first reaches it's destination. The nex time I ask them all to move somewhere else, they politely wait for one to go at a time, but nevertheless end up in the exact same spot as the others.

I dunno if it's possible for characters to merely get blocked by others, and stop there, or if they will invariably end up in the same place. It doesn't seem like a character.Moving check will work as they are under a move() command.

Any ideas?

Thanks!
#14
Hey all!

This has probabely been answered before, but my searching probabely had all the wrong words :P Is it possible for the same inventory item to be added multiple times at different indexes?

I tried:
Code: ags
 
  int i = 1;
  int Place = 1;
  while(i < (Game.CharacterCount)){
    if(character[i].x <= RightX && character[i].x >= LeftX && character[i].y <= BottomY && character[i].y >= TopY){
      player.AddInventory(iSelection, Place);
      Place ++;
    }
    i ++;
  }

But I only get one index with the iSelection item

Thanks!
#15
Hey all!
I've got into a little trouble with .dat files (again), and I wondered if you could help me out. I have a chapter selection system (similar to the ones in the Half Life games), and what I want to do is to RESTART the game everytime the player decides to start from a different chapter, so that I don't have to reset ALL variables, just reset some of them aftwerwards depending on the chapter selected. So I decided to write a few crucial variables into a .dat file like so:
Code: ags

//This happens when a chapter is selected to be loaded
BegunFromCh1 = true;
BegunFromCh2 = false;
BegunFromCh3 = false;
InMenu = false; //This is set to true when the game is manually exited
InGame = true; 
File *k = File.Open("NewGame.dat",eFileWrite);
k.WriteInt(InMenu);
k.WriteInt(InGame);
k.WriteInt(BegunFromCh1);
k.WriteInt(BegunFromCh2);
k.WriteInt(BegunFromCh3);
k.Close();
RestartGame();

Then, at game_start(), I have the following code:
Code: ags

File *l = File.Open("NewGame.dat",eFileRead);
  InMenu = IntToBool(l.ReadInt());
  InGame = IntToBool(l.ReadInt());
  BegunFromCh1 = IntToBool(l.ReadInt());
  BegunFromCh2 = IntToBool(l.ReadInt());
  BegunFromCh3 = IntToBool(l.ReadInt());
  l.Close();
  if(InGame == true){
    Display("Working");
    if(BegunFromCh1 == true) CH1();
    else if(BegunFromCh2 == true) CH2();
    else if(BegunFromCh3 == true) CH3();
  }
  else{ //InGame is set to false and InMenu set to true when the game is manually exited, so that the character returns 
          //To menu screen (Room9) when game is first started.
    cEgo.ChangeRoom(9);
    cEgo.Transparency = 100;
    Menu_ClickingState = true;
  }

and CH1() Looks like this:
Code: ags

function CH1(){
  Display("Working");
  mainstory = 5;
  cEgo.ChangeRoom(1, 650, 405);
  cEgo.Transparency = 0;
}

However, my problem is that InGame seems to never be true, as both times I have called 'Display("Working")', neither ever show up! And the character ALWAYS goes to Room 9. There is nothing in eEventRestoreGame that should intefer with any of this code, if that is at all relevant...
Thanks in advance :)
#16
Hey all!
  I'm trying to change a button's graphic to the graphic of a Dynamic Sprite within a function. I have read other posts, and tried to copy what they do, but strangely for me the button just turns up with a blank image. Here's the code:
Code: ags

 // At the top of the Global Script 
  DynamicSprite *s;

 // Later on...
 function bSave_OnClick(GUIControl *control, MouseButton button)
{
  s = DynamicSprite.CreateFromExistingSprite(31); //this is to test, I actually load another DynamicSprite's image
                                                                                // into this one...
  s.Resize(90, 60); //Optional, doesn't work with or without...
  bButton.NormalGraphic = s.Graphic;
  s.Delete();
  SaveGameSlot(btn, date); //these two are established elsewhere
  btn = 0;
  AfterSave(); //just does some business after the save
}

  I've even tried to reload an image into 's' and change the button's normal graphic in AfterSave() instead of bSave_OnClick, but no luck...
  Anyone have a solution?
   Thanks
#17
Hey all!
  I've been trying to make some 'constants', meaning Global Variables which remain the same even if you load a previous save. So if you save, then change some 'constant' variables, then reload your save, the 'constant' variable remain changed. I've been trying to use Files for this, but they don't seem to be working: here's the code I tried:
Code: ags

int Test //This is in GlobalVariables


function SaveGame( /*some unimportant variable in here*/){
  File *i = File.Open("Constants.dat",eFileWrite);
  i.WriteInt(Test);
  i.Close();
 //Game saving commands
}
function LoadGame(/*More unimportant variables*/){
  //Game loading commands
  File *i = File.Open("Constants.dat",eFileRead);
  Test = i.ReadInt();
  i.Close();
  Display("%d",Test);
}
 

  I saved the game when the variable "Test" had a value of 0, then I activated a trigger which would set "Test" to 1. I then loaded my save, but my display command showed "Test" to be 0 again!
  I figured that maybe Files are re-written when a game is loaded from a past save, so I changed my SaveGame() function to this:
Code: ags

function SaveGame( /*some unimportant variable in here*/){
  //Game saving commands, notice these now happen BEFORE the file is written!
  File *i = File.Open("Constants.dat",eFileWrite);
  i.WriteInt(Test);
  i.Close();
}

  But I still got the same result. Can anybody help solve this?
    Thanks
#18
  Hey all!
  I have some code in on_mouse_click() which goes like this:
 
Code: ags

    if(mouse.Mode == eModeWalkto  &&  AYardsWalked < 1760.0){
    XTarget = mouse.x;
    YTarget = mouse.y;
   }
   

 then I have some code in repeatedly_execute():
 
Code: ags

    if(cEgo.x == XTarget  && cEgo.y == YTarget ){
    Display("Working...");
   }

  all in GlobalScript.asc
   The problem is that the code in repeatedly_execute() never runs, meaning that mouse.x is not giving a good value to XTarget and YTarget. At first I though it had to do with the character never really reaching exactly where the mouse clicked, so  tried this instead:
 
Code: ags

    [code]
      if((cEgo.x >= XTarget - 10 && cEgo.x <= XTarget + 10) && (cEgo.y >= YTarget - 10 && cEgo.y <= YTarget + 10)){
    Display("Working...");
   }

  but still nothing, my game never displayed "Working..."
  What can I do?
   Thanks[/code]
#19
  Hey all!
   I wrote some script yesterday, which worked fine
   I altered that script today, adding new lines and replacing old ones, but the game still ran as if it was using that old script, and not the new one! I tried everything, even editing the entire section out, but the game just plodded along as if it were using yesterdays script!
   Does anyone know how to fix this?
    Thanks
   
#20
General Discussion / a £ sign?
Mon 19/07/2010 19:01:44
 Hey all!
  This seemed like the right forum to post it on, it's a bit of a silly thread...
  Just wondering, is there a possibility of a £ sign in AGS? i don't feel like going through 300+ dialogs and changing all the £ signs into $ signs. besides, I like the £ signs.
  Right now it turns up as a ? sign. Maybe I could make a new currency in ?, but Europe might feel cheated....
     Thanks
SMF spam blocked by CleanTalk