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

#281
I have found something of a problem with AGS.  I defined a enum in my header file (just a note, this has nothing to do with the dialog module) named, "CursorMode" so that I could keep track of the current cursor mode just a little bit differently than AGS does it, as well as make use of it in functions and what-not.

Anyway, when I was typing "mouse.Mode = " I noticed that the auto-complete function was displaying MY CursorMode enum values as legal values for mouse.Mode (in addition to the eModeXXX ones).  In fact, it even compiles correctly.

*In case it has anything to do with it, the enum did declare my cursor name enumerations with the same numerical value as the cursor number.*

My initial thought was that perhaps because my variable was defined as "CursorMode Mode" it was encountering some kind of ambiguity between Mode and mouse.Mode.

Changing Mode to MyMode had no effect however.  Then it occurred to me that perhaps it had to do with the enumeration name.

Changing CursorMode to MyCursorMode did change it.  It made it so only the mouse.Mode values were displayed, and not mine.

Well...That's fun.  ***BTW in case you're wondering as to the name, I titled it that because the mouse.Mode enum seems to have inherited my enum values...***  Nevermind that last bit... I changed the name.

#282
General Discussion / My Number 1 Hinderance...
Sat 21/05/2005 21:25:15
I had an amazing epiphany (sp?) last night.  My number one hinderance in making a game with AGS is my increasing knowledge.  I know that may sound crazy, but the fact is, I don't know everything about AGS and I certainly don't know everything about programming.

So basically, the problem is, I'm still learning, and when I learn something new, I look and my scripts and realize, they work, but:

1.  They are very sloppily coded.
2.  There is a more productive/efficient way of completing the same task.

So, to fix the problems, I start over re-writing the same code.  If I find a problem that I really can't figure out, I won't look at it for about a week, and then by that time I'll have learned a new way of looking at the problem.

You wouldn't believe the number of times this has happened, and it will almost definitely happen again.  So, I guess I'm writing this to ask, does anyone else feel the same hinderance posed by their increasing knowledge?  Or am I just completely insane?

[probably the latter]
#283
Ladies and gentlemen, allow me to present StringPlus, the successor of StrAdditions. Now with over 40 functions to increase your productivity, creativity, fertility, and your enjoyment of String functionality in AGS!

As a special treat, I've included no documentation! :=

If you have any questions feel free to ask. I'm working on the documentation now...in-between my job. ;)

Requires AGS 3.1.2+

Download v3.2
Mirror

Download v3.1 Thanks Neole!
#284
I don't have access to the manual ATM, but I did search the forums and couldn't find anything related to this, so...Is there a function like C++'s stringname.find_first_not_of() function?  I'm trying to find the first character that isn't one of a specific set of delimeters...Any help would be appreciated.
#285
I can't test this script ATM, but I was wondering if it at least looks like it would work right:

Code: ags
function dSetText(char option, string text) {
  #ifdef dialog
    StrCopy(dlg[dialog].opt[option].text, text);
  #endif
  }

function dText() { /* store dialog text -- use this to replace Dialogs tab in Game Editor */
  /**** DIALOG 0 ****/
  #define dialog 0
  dSetText(0, "My name's Guybrush Threepwood.  Prepare to die!");
  dSetText(1, "How did you get up there?");
  dSetText(2, "I'll just be running along now.");
  #undef dialog
  /**** DIALOG 1 ****/
  #define dialog 1
  dSetText(0, "This is the first option of dialog two.");
  dSetText(1, "It's not that fantastic, but it's just for testing.");
  dSetText(2, "I need to make six more after this.");
  dSetText(3, "One down, five more to go for this dialog.");
  dSetText(4, "Funny the way I gave up on trying to build a dialog tree.");
  dSetText(5, "A few more to go now...");
  dSetText(6, "This is making me tired.");
  dSetText(7, "This is the last one thank goodness.");
  dSetText(8, "Here's another just for good measure...");
  #undef dialog
  /**** DIALOG 2 ****/
  #define dialog 2
  dSetText(0, "This is going to try and push the limits of long text display by forcing this string to be cut in half.");
  dSetText(1, "It's just to try and prove that the system is working correctly.  I have no confidence in it at all...");
  #undef dialog
  }


I was trying to find a way to make it easier to setup the dialog text than several:

Code: ags
StrCopy(dlg[0].opt[0].text, "text");
StrCopy(dlg[0].opt[1].text, "more text");
/* ... */
StrCopy(dlg[15].opt[24].text, "other text");


I think you can see how this would become tedious having to redefine the dialog you were working with every time you needed it, so does this look like (and/or) (will/it) (it/will) work?
#286
In my global script there are several cases where I have accidentally set a char value to -1 (via function calls).  This isn't caught at compile time, but it is causing me some heartache at runtime.  It would appear (based on the illegal array indexes getting returned via error) that the char is converted from -1 to 255.  I could easily change the value I use (as the greatest one I need is 29 so I could use 30 as my null value) but I wanted to know if this was known and/or report it.  As a matter of fact, you can even explicitly declare a char with a negative value, however, I have just discovered a fun error when trying to display it:

---------------------------
Adventure Game Studio
---------------------------
An error has occured. Please contact the game author for support, as this
is likely to be a scripting error and not a bug in AGS.
(ACI version 2.70.856)

in Global script (line 173)

Error: Cannot display message with extended characters in SCI font

(Accented characters, for example the special French and German e/a/u/i letters cannot be used by default. You need to import a TTF font to do so).

---------------------------
OK   
---------------------------

I used the negative char to index an array with an index of 5 (0 - 4), and got this error message:

---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.70.856)

Error: run_text_script1: error -6 running function 'btnIconAbout_Click':
Error: Array index out of bounds (index: 255, bounds: 0..4)
in Global script (line 172)


---------------------------
OK   
---------------------------

So, hope this helps...
#287
Whenever I try to run this script from repeatedly_execute, I get an error ("null pointer referenced"):

Code: ags
char prevAt = -1;

function dlgHighlight() {
  /* highlight the (complete) dialog option under the cursor */
  GUIControl* controlAt = GUIControl.GetAtScreenXY(mouse.x,  mouse.y);
  if (controlAt != null) {
    char objAt = 0;
    while ((objAt < 7) && (controlAt.ID != objAt)) { objAt++; }
    if (prevAt != -1) {
      if (objAt != prevAt) {
        gDialog.Controls[prevAt].AsLabel.TextColor = 31055; /* release previous item */
        gDialog.Controls[objAt].AsLabel.TextColor = 13; /* highlight current */
        prevAt = objAt; /* store item */
        }
      else {} /* still over previous item */
      }
    else { /* runs only once */
      gDialog.Controls[objAt].AsLabel.TextColor = 13; /* highlight current item */
      prevAt = objAt;
      }
    }
  else { /* null control - release all items*/
    char buf = 0;
    while (buf < 7) {
      gDialog.Controls[buf].AsLabel.TextColor = 31055;
      buf++;
      }
    }
  }


The problem is that

Code: ags
  if (controlAt != null) {
    char objAt = 0;
    while ((objAt < 7) && (controlAt.ID != objAt)) { objAt++; }


the "if (controlAt != null) {" line doesn't appear to be catching whether the pointer is actually null as the null pointer reference is a limit for the while loop.  Either that or somehow the only line in-between the two "char objAt = 0;" is causing the pointer to become null.  What is going on here?
#288
Okay, I thought I had thoroughly searched the manual, but then in the "Pointers for people who know Java or C#" section I found this:

QuoteBecause AGS does not have a new keyword, you cannot create pointers to custom struct types.

The problem is, I either need a pointer to a custom struct type, or I have to make duplicate copies of the same data.  Any help on this matter would be greatly appreciated.  Since it hasn't been implemented, is it coming?

I've done my homework, searched the forums, the manuals, the tracker...I'm just asking...

I decided to add this to the end of the AGS 2.7 thread.  After searching several of the pages for the word "new"...

Actually, after trying to duplicate the data, I don't think it will be possible.  I'm pretty sure that I need a pointer to my custom struct type.  It won't work the way I want it to otherwise.
#289
I have two while loops that are causing me some heart-ache:

Code: ags
  while ((i > -1) && (dlgnum[dialog].optstate[i] != 0)) { i--; }
  while ((j < 30) && (dlgnum[dialog].optstate[j] != 0)) { j++; }


The problem is that the game appears to be checking the whole while statement, even if the first half proves to be false.  I need to run through these two variables where they are within the bounds defined (i > -1 and j < 30) and the optstate variable with index i/j does not equal zero.  If either statement proves false I have to break immediately.  Any help greatly appreciated.

BTW, AGS 2.7 Beta...
#290
Is it possible to use/find the object number of a GUI control witht he new scripting style (object-oriented)?  I'm in the process of rewriting my scrolling dialog template for the new style scripting and as an introduction (to myself) of the new style that will be used by AGS scripting, and I've encountered a potential problem.  I know (at least I think I do...) that the old-style scripting still works with the new style, but I had something like:

Code: ags
  int line = 0; // stores current line (0 - 6) of DIALOG GUI
  int shift = 0; // shifts text in appropriate direction
  int option = DialogVariable(0); // begin while loop at firstopt
  string text; // stores text to be set on label
  while ((line + shift) <= 6) { // sets text on label
    StrFormat(text, "%s", GetOptionText(option)); // format text
    if (optstate[option] == 0) // if option is ON
      SetLabelText(DIALOG, (line + shift), text); // set text on label
    else shift--; // shift text up
    line++; // go to next line
    option++; // and next option


That would set the text on to the labels.  The problem is I don't know how to access the object number with the new scripting style so storing the line number (label #) and shifting it (by changing the line number) work in a while loop.  I can always use the old-style scripting for this part if I have to, but I'm just looking for a better way...
#291
For two of my GUIs (VOLUME and TEXTSPEED) I want to allow them to turn on during speech with the keypresses that affect their values:

VOLUME
'-' = minus
'=' = plus

TEXTSPEED
'[' = minus
']' = plus

In order to do this, I have to call them from rep_ex_always.  I understand that much.  The problem lies with turning them off.  I did use a simple integer and decrement it from rep_ex, but that doesn't run during speech (even if the game is paused during speech (to my knowledge (and experience))) so, the question is how to implement a timer.  I had the int "timer" set to 100 so that it could decrement once a game loop until it reached 0 at which point it turned both GUIs off.  I tried using the built-in timers (SetTimer and IsTimerExpired) but I couldn't get that to work properly either.

So...how can I make it to where my GUIs turn off after 100 game loops (as rep_ex_always runs faster than the game speed)?  It's not necessarily essential to change them during speech, but it was possible in the interface I'm emulating...

Thanks for any help!
#292
With an increasing number of topics becoming locked for one reason or another, some pages are being pushed to the second and third pages of certain threads, where they are less likely to be viewed, often encouraging "bumping".  Therefore, I have a question/proposition:  Would it be possible (well of course it's possible, but would it be ethical/feasible) to make locked topics appear at the end of the thread?
#293
This is still very much a WIP, but I want to show it off and maybe get some C&C.



This is the design for my new logo for my game company, Monkeymoto Productions, Inc. I sketched it mostly freehand (except the parts which I traced for uniformity), and then deleted most of the paper in Photoshop (I sketched this on notebook paper). I know that the "PRODUCTIONS, INC." needs to be moved over, but I forgot to move it before uploading it to the ImageShack. Let me know what you think.
#294
I have just discovered the "GetTextWidth" function, and I was wondering about it. Is there a way to test where (and/or if) the text exceeds a certain amount. For example, if the text width was 345, could I find what the text was at 320, and cut the rest into a separate string? Or does wrapping cause the text width to end, producing no greater value than 320? In any case, thanks for any help. I'm still looking for a way to provide multi-line text for my scrolling dialog workaround, so any ideas would be greatly appreciated. ;D
#295
Well, it's been a long time since the summer of 2004. That's when I officially began working on this project. And I think I now have enough to post about a game instead of just an idea. Yes, I know what you're thinking, another Monkey Island game? Well, I'm don't care if others have made Monkey Island games, I'm going to produce my fangame, like it or not. :) The GUI is at 99% completion, and in case you haven't heard, it's in the style of The Secret of Monkey Island. I have payed very close attention to details (although there is still that 1% of stuff to take care of), and if I ever decide to quit being lazy, I'll re-install Photoshop and finish enough graphics to make the first demo. Ok, as for the story, I have the intro pretty much laid in stone:

Guybrush Threepwood and LeChuck are locked in a fierce round of Insult Sword Fighting on the cliff with a view (on Monkey Island, from SOMI). Guybrush is standing very near the edge of the cliff when the user gains control. The user has to choose an insult to attempt to outwit LeChuck with, but of course, LeChuck knows the appropriate come back, causing Guybrush to take a step back, putting him right on the very edge of the cliff. Then, LeChuck will call out an insult for you to reply to, and the user's reply determines the out come of the intro. If the user's reply is the correct come back, Guybrush and LeChuck drop their swords. LeChuck then punches Guybrush, who goes flying off of the cliff. Otherwise, Guybrush takes a step back, and falls off the cliff. (It's kind of a no-win situation...) Either way, Guybrush wakes up in the river bed. "Where am I?" he asks himself, "And why does my head hurt?"

Then, I run the opening credits and at least half of the game will be a flash back leading up to the fight on the cliff. The rest of the story is largely variable depending on feedback from the members of the Milegend.com Forums, a large Monkey Island community. But, some things are certain, Guybrush and Elaine will have to return to Monkey Island, where they will once again find (who else?) LeChuck. The story will likely have many plot twists and possibly some flashbacks to times in-between the Monkey Island games. I plan to try to fill as many of the plot holes of the games as I possibly can. Oh, and I'm working on this game myself, and it's my first game ever.

Screenies:





http://img99.exs.cx/img99/2957/tmiscreen0013qc.png
http://img99.exs.cx/img99/3355/tmiscreen0038kz.png
http://img98.exs.cx/img98/1341/tmiscreen0053ek.png
http://img98.exs.cx/img98/8656/tmiscreen0060qy.png
http://img98.exs.cx/img98/2959/tmiscreen0078pp.png

This webhost doesn't allow hotlinking, but I don't have time to move it. I'll post the screenshots later. If I don't get off the computer soon, my dad is going to turn it off, so I'd like to at least get a copy of this posted...

EDIT: Screenshots updated. They should work now.

EDIT: Couldn't get 2DAdventure to work. Now hotlinked at ImageShack.
#296
I noticed that when the player was walking, if the user clicked the mouse, the player paused for a moment, and his walking view started over. That is because in on_mouse_click I had:

Code: ags
// on_mouse_click
// button == LEFT
ProcessClick(mouse.x, mouse.y, mode);
// stuff


So, it was re-processing the click. I changed the code to this:

Code: ags
// on_mouse_click
// button == LEFT
  if ((character[GetPlayerCharacter()].walking) && (GetCursorMode() == walk)) {}
  else ProcessClick(mouse.x, mouse.y, mode);
// stuff


That way, it would only process the mouse click if the player wasn't already walking and the cursor mode was walk. Otherwise, process the click as normal. This script worked, somewhat, but the player animation still shows a skip or something. It appears that when I click the mouse (and the cursor mode is walk and the player is walking), that the player is set back to the first frame in the view. Is there a different way of doing this so that the player's walking view runs smoothly?
#297
This template is officially deprecated.  I would suggest using the ScrollingDialog script module, which is its replacement, found here.  Thank you.

ATTENTION:

This template was designed within and for AGS Version 2.62.  It is now outdated, although it's replacement is still under construction.  It was never fully implemented, but the missing features are getting worked on in the Script Module that will replace this template.  You are still free to use this as you see fit, but as I now use AGS 2.7 support may (and probably will) be limited!

--

I've been waiting a long time for scrolling dialogs to get off of the AGS tracker, but it's still there. So, I got bored and did it myself (a.k.a. I promised authenticity, and I'm pretty anal about it). I want to thank those who helped me with label-clicks and multidimensional arrays.

Things to note:
If you download the template, make sure you do not change these settings
1. This is entirely script-based and does not use AGS's built in dialog interface.
2. This script is customized for a 7 label GUI "DIALOG" that display the text for the dialog.
3. Customized for a 2 button GUI "DLGARROWS" with arrows that turn off if you can not scroll in that respective direction.
4. With the current script you can not have text that spans longer than 1 line.
5. DIALOG and DLGARROW GUIs MUST be normal GUIs not pop-up modal.
6. The "dlg" struct is contained in the header file.  I'm not sure if it can be moved, but that is where it's at.
7. I wrote this script, so if it's not too much to ask, I'd like some credit.

Now that that's said and done, the script:

[EDIT: See latest script here.]

;D Michael Rittenhouse

Last edit:  13 March 2005
Local time (at edit):  5:20 P.M.

(Edited by strazer to add first note)
#298
Arrays have officially been implemented into AGS, but multidimensional arrays don't seem to work. I keep getting an error when I try to create one (such as int num[8][16], it returns the error "Unexpected "["). And something else. How do you make an array of strings? I can initialize a string array

i.e.

Code: ags
string strarray[30];


But I can't assign any values. I tried:

string strarray[30] = {
Ã,  "str1",
Ã,  "str2",
Ã,  "str3"
Ã,  };

But it returned "You can't assign a value to an array. So I tried:

StrCopy(strarray[1], "str1"), etc... but it said "Type mismatch: string with non-string." Oh well. It's Christmas. I set the clock ahead a day to work on my game, but I guess I can't figure out what I'm trying to do anyway. Oh well.
#299
Is it possible to test if the user clicks on a label? I know about the interface_click function, I've read the manual, and I even searched the forums. So please, don't flame me. I tried testing for label-clicks in interface_click, but it didn't work. Let me know if you need to see the code. (Which I have already deleted, otherwise I'd post it...)
#300
For the label I'm using in my map rooms, which has the text, "@OVERHOTSPOT@", I have the following script:

Code: ags

//in repeatedly_execute()
  string maptext;
  GetLocationName(mouse.x, mouse.y, maptext);
//  SetGUIPosition(MAPS, (mouse.x-(StrLen(maptext)/2)), mouse.y);
  SetGUIPosition(MAPS, mouse.x+5, mouse.y+5);


If I try to set the GUI position to the position of the mouse cursor, centered on the x-axis (mouse.x-(StrLen(maptext)/2)), the game becomes paused, and I can't un-pause it. But if I set the GUI to the position of the mouse +5 on the x and y axises (mouse.x+5, mouse.y+5) the game does not pause, and the label is shown appropriately. If you're asking how I know the game is getting paused, on_mouse_click isn't getting run when I set the GUI position to where I want it (the commented code)... Help would be appreciated!
SMF spam blocked by CleanTalk