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 - 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
Wouldn't this work?
Code: ags
lSaying.TextColor = this.SpeechColor;
I think that's what Snarky meant - Setting the color (or colour, if spelled correctly ;) ) of the label's text to that of the relevant Character's speech colour?

If not, for whatever label you need to have the color changed for, the same principle applies.
#4
It makes sense that if your code is moved to repeatedly_execute(), then it won't play whenever a command is executed which "blocks" the script (eBlock). You'd want to keep the audio code in repeatedly_execute_always(), since it always runs regardless.

How many channels do you have going? AGS has a limit of 5 channels, with an additional 1 channel set aside for Music, Ambient Sound and Voice respectively. I've never hit the channel cap, but maybe that's what's causing these issues? That's not to say that you can't HAVE more than 5 Channels, but you can't have more than 5 ACTIVE at any one time.

I know it's not really solving the issue, but you can tie a sound effect to a frame in a character's walk animation instead. In the view for your character, click on the relevant frame (where the foot comes down), then in the menu on the bottom right click on "Sound". You should be able to select a footstep sound to attach to that frame. You can change the sound later on in the script (if you want to change it during runtime) using a ViewFrame *object:
Code: ags
ViewFrame *v = Game.GetViewFrame(int View, int Loop, int Frame);
v.LinkedAudio = aFootsteps;
#5
Do you mean a separate health bar level for each opponent? In that case, have an array in a custom/global script and export it for global access (if you need it) - each array entry starts with the player's max health, but you can call it to set a health bar value.
So:
In GlobalScript (or another custome script).asc
Code: ags

#define MaxHP 100 //The player's initial HP for each fight
int HP[30]; //if you have say 30 opponents

function game_start(){ //Assign each array value to the max HP
  int i;
  while(i<30){
    HP[i] = MaxHP;
    i++
  }
}

//At the end of the script:
export HP;

In GlobalScript (or your own script).ash:
Code: ags
import int HP[30];

Then whenever you want to assign your health bar value at the (re)start of a fight:
Code: ags
HealthBarValue = HP[X]; //Where X is whatever 'slot' you want that particular enemy to take up


There are ways of automating this a bit more - if your enemies have a character ID of 1-30 (with the player having an ID of 0) then the above line could be:

Code: ags
 //somewhere
Character *challenger = cDaddyD
//elsewhere
HealthBarValue = HP[challenger.ID-1]; //Subtract 1 since the array indexes go from 0-29


Hope that helps :)
#6
Hello Fluxpuppy,

You can definitely have a bool check inside another bool check - just make sure to format it properly so that you can understand how 'deep' you are at any point. Here you are missing a second closing bracket to close of your first if statement. Your code here is also missing the double quotation marks in line 6, so your string is over-running until line 11.

Code: ags
function hHotspot4_Interact()
{
 if (headonshoulders == false) { //If statement 1
 cgarth.Say("It's full of fireworks!");
 if (takenfwork == false){ //If statement 2
   cgarth.Say("I'll take one.");
   cgarth.AddInventory(ifirework);
   takenfwork = true; } //Closes off If statement 2
 else {  cgarth.Say("The sleeping man is in the way."); } //Else statement to If statement 2
                                                           //Note: I have indented it here to match If statement 2
 } //You were missing a this to close off If statement 1
}


EDIT: Beaten by Andail :)

EDIT 2: If Andail is correct about the sleeping man, then this code is wrong anyway :P
#7
Hello Slasher;

I don't see why not; it sounds like a pretty cool idea 8-)

Of course, there'll be a lot of things to take into consideration, not least the order in which you write into/read from the files will have to be very specific, and you'll probably want lots of different files. I don't know much about externally writing into files (encryption type, etc). What I might do is have a separate AGS game full of wonderful spreadsheets and stuff to write into files from there, then read them from the other game.

But yah, it sounds like an exciting idea, and doable :) Of course, AGS is not a perfect OOP program, (Rooms and stuff will need pre-setting) but it's good enough AFAIK

All the best!
#8
Well, it's a matter of preference I suppose...personally I'm more inclined to my method, but that's just psychiatry :P I think it's mostly a difference in the level of control that you have over the process - there is a slight chance that the dummy character's walk-way is different to the characters, because it has no (or less) baseline for collision detection, and because it's a certain way ahead of the character, so the character could get intercepted for some reason. But that is a very slight chance, and the dummy method is far quicker...

So yah, personal preference :)
#9
What you could do is reset the first frame of all the other animations when a character's direction is determined - something generic which would suite all 3 turning animations (depending on which way the character turns). Say if you stored which way the character was last walking in an array, and when they are not in that loop anymore, you execute the relevant animation, re-assign the first frame of the direction the character is now travelling in, and re-issue the walk command. It will require a few custom functions...

So:

1: -> When character starts to walk, set ALL the frames of the Loop your character is NOT in to a generic "about to turn" graphic

2: -> When this character's loop changes, stop the character and execute the relevant turning animation depending on their new loop

3: -> Now check for when the animation is on it's last frame...

4: -> Reset the first frame of the character's current loop to it's original, and set ALL the other frames to another generic "about to turn" graphic (this will be different as the character's loop is different)

5: -> Give your character the same walk command as was first given. This will mean you have to store coordinates and all that stuff yourself as well, so lots of custom functions!

!Make sure to be specific about when the game checks for loops and stuff, since you don't want the game to start doing weird stuff when you have other animations. I would have at the very least a custom walking function and custom stopping function, and variables telling the game whether the characters are walking from these functions.

!Also, repeatedly_execute_always() is a better function to check in, as it means that if the game is blocked for some reason, your character won't do weird stuff. Just beware that you can't give any commands in this function, or any function it calls, that are blocking. This is why I have included step 3 - if you animate your character and pass a blocking clause, then repeatedly_execute_always() won't be very happy with you.

Hope that helps! :)

#10
The editor can also show you where the closing brace is, or whether it exists. When you have the bracer highlighted, or the text cursor next to it, you can press 'CTRL-B'; the bracer will show up yellow if it has a matching bracer, or red if it doesn't. In the case of a matching bracer, that is also highlighted in yellow.

Hope it helps!
#11
Oops; - I should really learn which way is left :P

I've put it under the 'RUN TIME' section now and no compiling errors.

Thanks very much :)
#12
Hello!

Sorry to drag this post up again - I didn't want to start a new thread however for the same reasons as Monsieur OUXX in 2012...

I have completed all the coding parts of Calin's tutorial, but I get the following compiler error:
Quote1>c:\program files (x86)\ags - test 3.3.0\dll\ags_template.cpp(69): error C2065: 'engine' : undeclared identifier
1>c:\program files (x86)\ags - test 3.3.0\dll\ags_template.cpp(69): error C2227: left of '->RegisterUnserializedObject' must point to class/struct/union/generic type
1>          type is ''unknown-type''

However, I think I am pointing to a class, since that line looks like:
Code: cpp
engine->RegisterUnserializedObject(key,newlight,&gManagedPXLightInterface);

And the ManagedPXLightInterface class is declared and an instance of it (gManagedPXLightInterface) is created:
Code: cpp
class ManagedPXLightInterface : public IAGSScriptManagedObject{
public:
	ManagedPXLightInterface(){}
	virtual int Dispose(const char *address, bool force){
		delete address;
		return 1;
	}
	virtual const char *GetType(){
		return typeName;
	}
	virtual int Serialize(const char *address, char *buffer, int bufsize){
		memcpy(buffer,address,sizeof(PXLight));
		return sizeof(PXLight);
	}
	static const char* typeName;
};
const char* ManagedPXLightInterface::typeName = "PXLight";
ManagedPXLightInterface gManagedPXLightInterface;


My code is almost exactly copied from Calin's, with the only difference being that the cpp file is the plugin template, and I've changed the struct/class name

Many thanks in advance!

EDIT: Sorry, I should mention I am using VC++ 2010 Express
#13
I feel like a fresh upstart who has no right to comment on this thread, since I first coded in Javascript when I was 14, on Windows XP :P By the time I finished my project I could understand the whole book I taught myself from (Java (Something) For Dummies), but still had no idea how to combine the compiler and IDE properly, so none of my code could execute. Then this new-fangled fancy AGS comes along and combines it in an easy package :D
#14
Thanks very much Calin - works a treat :)
#15
Hello again!

Thanks very much for your advice Calin - it's working very well so far :) (although has a wonderful habit of fragmenting the image)

I was wondering whether it is possible to apply the tint in part - so fulfill the same function as the 'Saturation' parameter in commands such as 'SetAmbientTint'. The Saturation paremeter I've set in place is also from 0...1, but I'm not sure how to employ it. My best Idea so far was to bring the numerical gap between the original colour and the tint colour for each component (R,G and B) closer in accordance to the saturation parameter.

So if my original R (oR) was say 20, and my tint R (tR) was 10, and the saturation was 0.1, then tR would turn to 19 (0.1 x the gap) - However, I don't think this is working correctly, and it was only a wild guess.

Am I on the right track, or am I wildly off target in terms of saturation?

Thanks again! :)
#16
Perfect, thanks very much Calin, I shall test it today :) It might work faster coded on an engine level, but I'm guessing it's the same principle :)

@selmiak:
Hmm...moving sunrays is a pretty cool idea - I might look into defining a light region by its source and strength, and allowing the player to define 'solid' (i.e. light blocking) objects and areas :)
#17
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! :)
#18
Hello Baron;

Two solutions came to my mind - one a bit of work, and the other one speculative:

For the speculative one - does AGS support "&001" as well as "&1"? Might be worth a try, because then you can always take the same amount of characters from your string.

The Other Method may be to create a custom function which accepts both the text and the invisible characters - maybe:
Code: ags
Character.Speak(String Text, String Speech)

So you would use it like:
Code: ags
cEgo.Speak("My, what a fine bottle of shampoo","&1");

You can then get the first String and use it's length for the bubble, then combine both strings. (Using String.Append()) It'll be a bit more hassle, since you'll have to go through all instances of when the character speaks and replace them, but this method should hopefully work :)

Hope that helps!
#19
Sure, just use a 'random' function and insert that into whatever method you choose. 'Random' gives you an integer number between

So for Monkey_05_06's, you could create a separate string called "password", and assign every value to a random number
Code: ags
String password = String.Format("%d%d%d%d", Random(9), Random(9), Random(9), Random(9));

then you would check the user input string with the 'password' string:
Code: ags
if(sPanelPassword.EndsWith(password)) //Success!


For Monkey424's method, I'd create another set of arrays, which we'll call 'B', then assign each to a random number. So:
Code: ags
int B[4];
//probably in game_start or something
B[0] = Random(9);
B[1] = Random(9);
B[2] = Random(9);
B[3] = Random(9);

Then to compare:
Code: ags
if(A[0] == B[0] && A[1] == B[1] && A[2] == B[2] && A[3] == B[3]) //Success!


So basically, use Random(int) to achieve the randomizer for the code.

Hope that helps! :)
#20
Hmm...generally you shouldn't have to export functions - export is just for variables afaik (including struct objects).

In AGS, functions can only access other functions which are 'above' them, although I'm not sure what the technical terminology is. So if function A is above function B, then B can call A, but not visa versa. This goes the same for script order - if script Y is above script Z, then functions in script Z can call any function in script Y, but functions in script Y cannot call any function in script Z. Any function in GlobalScript should be able to call any function in other scripts, therefore, since it is at the bottom.

I'm not really sure what you meant when you said:
Quote from: HandsFree on Fri 21/02/2014 12:56:30
I'm trying to make a function Scare_Unicorn() (in GlobalScript) available to roomscripts and the cUnicorn.Look function which is in a separate script.
Does that mean there are two functions in GlobalScript which call unicorn_look_handler();? Are you attempting to import the cUnicorn_Look() function into GlobalScript.ash? On which line is the 'unresolved import' message highlighted? Perhaps cUnicorn_Look() is attempting to call Scare_Unicorn() which is below it, or visa versa...
SMF spam blocked by CleanTalk