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

#21
Okay, I got it! It's a bit hacky for now, but the creation function looks like this:

Code: ags

function Epic::Create(int questID,  const string questTitle, const string questDesc) {
  this.title = questTitle;
  this.desc = questDesc;
  this.complete = false;
  this.ID = questID;
  questList.AddItem(this.title);
  active_quest[active_quests] = questID;
  active_quests++;
}


It's a little hacky, because unfortunately quest creation now looks like this:

Code: ags
Quest[2].Create(2,  "Get Ready for Work", "You need to get ready to go to the office. Don't be late!");


But it's something I can live with for now.  :wink:
#22
Okay, I've implemented everything, unfortunately the game now crashes when clicking on Quests in the UI.

Code: ags
Error: Null string supplied to CheckForTranslations


I'm maybe getting the impression that perhaps the active_quest variable isn't actually touching the struct itself, which is what I need to access.
Maybe it's not a bad idea to set a quest as active upon creation?
#23
Woah, nice! I'll give that a stab and report back!  :cheesy:
#24
Update: I managed to wrap my head around the first problem with Structs. It turns out that I needed to define an instance for my quest creation function to work.

So now, the Header looks like this:

Code: ags

struct Quest {
  String title;
  String desc;
  int ID;
  bool complete;
  import function Create(int questID, const string questTitle, const string questDesc);
};

import Quest playerQuests;


And the Global Script has this at the top:

Code: ags

Quest playerQuests;
export playerQuests;


Meaning that I can now call the creation function like so:

Code: ags

playerQuests.Create(2,  "Get Ready for Work", "You need to get ready to go to the office. Don't be late!");


While the naming convention could probably be cleaned up a bit  :tongue:, I'm relatively happy to see that the result matches exactly what I was doing before, but now I can create the struct and theoretically access it.

The new question now is, how do I reference values stored in the struct to update my GUI label?
#25
Edit: This has been solved. Check out the solution!

I'm in the process of building out an adventure RPG in Adventure Game Studio, and over the past few months I've been making some pretty good progress.
Recently, though, I've wanted to implement a quest system, as a sort of visual way to assign things to the player and give them the opportunity to track things they have left to do.

In the process of building this, I've come across a few constaints, and haven't totally worked out the bugs yet. I'd like to touch upon what I've gotten working so far, along with a few ideas I've had.

Creating a Quest
Currently, Quest creation is little more than adding a new String to a ListBox. It looks like this:

Code: ags

function createQuest(const string questTitle,  const string questDesc) {
  questList.AddItem(questTitle);
  qDesc.Text = questDesc;
}


What we end up with looks like this:

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

The Description Problem
Anyone with experience in AGS will immediately realize there's a bit of a problem with doing things this way: the description is not actually being stored! The UI label just gets updated every single time a new quest gets assigned.

I've looked through the forums a couple of times to determine how exactly I'm supposed to update the label upon selecting a particular ListBox element. Thankfully, SelectedIndex is a thing, so we can at the very least update the label based on what the description is, like so...

Code: ags

function questList_OnSelectionChanged(GUIControl *control)
{
  if (questList.Items[questList.SelectedIndex] == "Sample Quest") {
    qDesc.Text = "The interface should update when selecting this";
  }
  
   if (questList.Items[questList.SelectedIndex] == "Get Ready for Work") {
     qDesc.Text = "You need to get ready to go to the office. Don't be late!";
  }

  else {
    qDesc.Text = "No description. Please select a quest.";
  }
}


Unfortunately, this is kind of unwieldy, and goes against the principle of DRY (Don't Repeat Yourself) in programming. It might not be a problem if I only have a dozen or so quests, but it doesn't exactly scale up if I want a game with 60+ quests or something. It also kind of goes against the initial function pattern I was hoping to follow.

Another headache that I've noticed is that SelectedIndex appears to only work on matching results against an exact title. One thing I'd love to figure out is whether or not it's possible to use some other kind of value, like an ID or something. My thought is that, if I could somehow store the description somewhere, and associate that with the title, I might be able to update certain elements through that association.

A Possible Solution - Structs!
So, I've been banging my head against the wall, trying to figure out how to store Quests as a type of Script Object that can be referenced in the UI. I came across the AGS Documentation on Structs, and it almost seems perfect...

So, in the global script header, I defined my Quest struct like so:

Code: ags

struct Quest {
  String title;
  String desc;
  int ID;
  bool complete;
  import function Create(int questID, const string questTitle, const string questDesc);
};


I also have this function in the Global Script:

Code: ags

function Quest::Create(int questID, const string questTitle, const string questDesc) {
  this.title = questTitle;
  this.desc = questDesc;
  this.ID = questID;
  this.complete = false;
  questList.AddItem(this.title);
}


The editor compiles with no problems, and this seems to be a semantically better way to generate quests. Now, whenever I try to create a new quest, I define an ID, the title, and the description, and it should get added to the Quest UI.

Let's try this with a Sample Quest...

Code: ags

  // Generate fake quest
 Quest.Create(1,  "Sample Quest", "The interface should update when selecting this");


This is unfortunately where I hit my first serious snag with Structs. Upon attempting to compile, the editor gives me an error:

Code: ags

GlobalScript.asc(198): Error (line 198): must have an instance of the struct to access a non-static member


At this point, I'm not really sure about what I need to do to move forward. This is the first time I've tried to work with Structs, and it's not 100% clear how I'm supposed to make them accessible to global or local scripts. Unfortunately, many of the examples I've seen of Structs being used are fairly abstract, or fit use-cases that are put together quite differently.

Goals and Questions
Ideally, what I'd like to do is successfully generate a Quest struct, and update the Quest UI so that the ListBox gets populated and the Label gets changed in a more efficient way.
Here are my questions on "How do I...?"


  • What am I doing wrong in creating the struct from the function?
  • Can SelectedIndex use something other than the Quest Title for setting the label? Such as an ID?
  • If I have to use the Quest Title for SelectedIndex, how might I be able to parse out other values of an existing Quest struct and update the UI accordingly?
  • Given that ListBox has a relatively limited API, is there a way to include sprites inside of the ListBox to represent completion state?
#26
----------------------------------------------------

MODERATOR NOTE (12/10/2016):

Hello!

This thread is an archive of offers made prior to 2016, which will continue to exist for legacy's sake. Some of the later offers may still stand, but many of the earlier ones probably don't.

For current offers, please see the Offer Your Services! 2016/2017 thread.

Thank you. :)


----------------------------------------------------



It seems you've cleaned out the old entries, so here's mine. :)

Web Designer

I specialize in Drupal sites, and can give you a totally integrated forum, series of galleries, community blog posts, you name it. I can build websites to custom-fit a use case. I'm looking at expanding my portfolio, so the first couple of people that contact me here will get my services and consultations for absolutely free. You don't even have to bribe me with one of your games.  ;)

"Well now," you say casually, "what all can you make with a Drupal site?"

You can have:

-A news site
-A site with reviews of things
-Galleries
-Built-in forums (comes with private messaging, possibly even group functionality if needed)
-An events site.
-A podcasting site
-Something to showcase your game team or company
-A portfolio
-Some kind of user-generated-content thing, like "Texts from Last Night"
-A video portal featuring videos you've done.

Check out my website here.

Please note that I do have to feed myself at some point, so I can only keep this going for so long.

So wait, what do you do?
I build and design websites.

What does that entail?
Graphic design, coding, and CSS work. I can also put some jQuery and HTML5 magic into your site. ;)

Can you do Wordpress?
I really don't like Wordpress very much, but I am competent enough to put sites together in it. However, I'll always argue to use Drupal over it, for a multitude of reasons.

If that promotional thing is over, how much do you charge?
The initial consultation is always, always free. Just private message me, and we'll set up a Skype chat or something to further discuss it. I can't realistically give a price without evaluating the scale of a project. So let's talk about it!
#27
Quote from: Domino on Thu 11/03/2010 00:25:32
Technocrat, if you were a female wearing that outfit, I would take you out this weekend. Oh well.

:-*

Nothing a little makeup and a quick viewing of Rocky Horror Picture Show won't fix.
#28
Quote from: Technocrat on Wed 10/03/2010 13:36:58
This is how I dress at weekends.  =^.^=

I'm deeply, deeply aroused now.  :=

Here's me. My webcam is especially bad, and ends up making everything look like it's out of a bad bootlegged Russian porno from the 70's.



#29
Here's me nowadays.


I rather think I've gotten more handsome, I used to be really ugly.

Oh yeah, and Nightfable's pics are cute.
And Disco's is awesome.
#30
The Rumpus Room / Re: Happy Birthday Thread!
Tue 31/07/2007 13:56:28
Quote from: Mr. Buckéthead on Tue 31/07/2007 13:49:37
Concratulations Alliance! I didn't know you were a few days older then me.  :)
I didn't know, either! It's going to be a good one, I think!
#31
The Rumpus Room / Re: Happy Birthday Thread!
Tue 31/07/2007 13:38:01
I turned the ripe old age of 17 today. W00t!
#32
Time for me to post my latest photos.







#33
How about this?

"The Greatest Backstory Game"

Basically, someone posts a link to a commercial from YouTube, and someone has to come up with a backstory to that commercial.

For example, a commercial showing a man feeding a dog and acting totally obsessed about it would be posted, and someone would post what the hell is going on.

Commercial-Man feeding dog.
Backstory- That's not his house...or his dog...

My dad and I do this kind of thing all the time whenever we're bombarded by five minutes of commercials.
#34
He-Man, your band sounds top notch!
#35
Quote from: Evil on Thu 27/07/2006 08:41:11
It won't work out. If you like the idea, just sugjest it for MAGS. It'd be pretty much a one time thing anyway.
Well okay then, I hereby suggest it as a MAGS.
#36
Quote from: Gilbot V7000a on Thu 27/07/2006 08:05:42
Well it sounds a bit just like the AGS Team Challenge activities, which never work properly.
Ah, give it a shot. You might like it.
#37
The Junkard Game

A few teams are formed by regulars on the AGS forums.
Basically, I post a basic plot of the game, which is pretty basic, along with a bunch of random screenshots from classic games.
I also name the style of sprites, which could be anything.
Then, the teams have 15 days to make a game using background textures only from the screenshots, no where else.
After that, we vote, and the game gets featured as a Junkyard Game.

Well, what do you think?

EDIT:
Quote from: Andail on Fri 30/06/2006 12:04:55
News:
We have decided not to treat any new suggestions until the voting and the cleaning up is over with. Feel free to discuss current competitions and activities in the mean time.

Shoot...
#38
Time for a few pictures of me.


Me as a bum. The backdrop is photoshopped in.


Kinda crappy Photoshop, done for a myspace competition.


Lookie, lookie, I'm a Jihad! Al Quaeda will never know what hit them. AL LA LA LA LA!


Me on a fake time magazine, because someone asked why were they making an issue about some teenager.  :P
SMF spam blocked by CleanTalk