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

#2081
Your first idea should work fine. What does happen if you try it?
If the dialog doesn't even show up, be sure that the dialog entry point (if you have one) says "return":

@S  // dialog startup entry point
return
@1  // option 1
stop
@2  // option 2
stop
@3  // option 3
stop

or remove it altogether. Also, be sure that each option's "Say" checkbox is ticked.
Works for me.
#2082
And AGS v2.62 will have the NewRoomNPC command, similar to NewRoomEx. It's already available in the beta version.
#2083
Yeah, put
game.abort_key = ASCII;
in the game_start function, where ASCII is the new abort key combination (for example 24 (CTRL+X)).
#2084
Beginners' Technical Questions / Re: Error
Thu 21/10/2004 00:41:49
You can also change the sprite number by right-clicking the sprite and selecting "Change sprite number...".
#2085
No, I agree.

Those backgrounds look very nice, but I think the 3D character doesn't fit in there.

But that's just me.
#2086
Quoteis processclick one of those oddball functions like NewRoom, etc?

Possibly. Since AGS can only run one script at a time, it can't run any interactions initiated by the mouse click until the on_mouse_click function has finished.

If you tell us what MyCode is for, what you're trying to do, we could suggest a workaround.

Edit:

On the other hand, does it work if you put the commands from the MyCode function in the on_mouse_click function directly?
#2087
Nevermind, I have found out how to do it myself:

Code: ags
function GetCharacterSetting(int charid, int property) {
  if (character[charid].reserved[0] & property) return 1; else return 0;
}


Returns 1 if setting is turned on, 0 if it is turned off.

Example:

Code: ags
int oldsetting = GetCharacterSetting(GUY, CHAR_NOINTERACTION);


Works with:

CHAR_IGNORESCALING           the editor 'Ignore room area scaling' checkbox
CHAR_NOINTERACTION           the editor 'No interaction' checkbox
CHAR_NODIAGONAL                the editor 'No diagonal loops' checkbox
CHAR_IGNORELIGHT                the editor 'Ignore room area lighting' checkbox
CHAR_NOTURNING                   the editor 'Do not turn before walking' checkbox
CHAR_WALKTHROUGH             the editor 'Can be walked through' checkbox
CHAR_SCALEMOVESPEED        the editor 'Adjust speed with scaling' checkbox

CHAR_IGNOREWALKBEHINDS   used by SetCharacterIgnoreWalkbehinds

NOTE: It's a bit of a cheat, so use with caution. It's not officially supported and may stop working at any time!

EDIT:

Quote from: PumamanSounds like a plan -- I'll expose the flags as a readonly variable.

AGS v2.63 Beta 1 exposes said variable. Thanks CJ!
So if you're using v2.63 (or above), just replace
Code: ags
  if (character[charid].reserved[0] & property) return 1; else return 0;

with
Code: ags
  if (character[charid].flags & property) return 1; else return 0;
#2088
To me it sounded like the waterline is not straight and with variable depth, so a view with a fixed waterline may look awkward.
#2089
I'd say it depends on the layout of your background and whether the character's legs should be visible in the water.
If you don't want legs, would a walkbehind work? If you want legs to be visible, you could try putting a semi-transparent object in front of the water background.
Either way, you'd have to set the baselines accordingly.
#2090
I have my own character control script, and I turn characters that are not in the current room invisible with SetCharacterTransparency(charid, 100) so they can still be moved and perform their command chains in the background.

SetCharacterTransparency retains clickability (which is a good for my rain script, but I digress), so I have to turn that and walkthrough off if they're not visible.
At the moment, I pass the nointeraction setting manually as a parameter to my ccStartExecution function and save that setting in an array.
I'd find it more convenient if I could use the character's settings from the editor instead of hardcoding the relevant settings for each character.

So it's certainly not high priority, but I assume this wouldn't be too hard to implement, hence my suggestion.
#2091
There's obviously a function name clash for the SetCharacterProperty counterpart, so how about SetCharacterProperty returning the old value of the setting, just like SetGameOption? I'd find this very useful.
#2092
No problem, I'm glad to help. The script is off the top of my head, so report back if something doesn't work like you want.

Quotesecondly, I need a clear-up about the room_a() function; should I copy it to the global script in the repeatedly section? I'm not quite sure where to stick it..

You have to create the function from the room interaction button (labelled "i"). Double-click "Repeatedly execute" and choose "Run script". Put the script in there.

Edit:

I forgot to mention, you also have to empty the queues when the player leaves the room (when walking onto a region for example), so the interactions don't get triggered in the new room:

Code: ags
function on_event (int event, int data) {
  //...

  if (event == LEAVE_ROOM) {
	interactwith = -1; // stop queued interact commands
  }

  //...
}
#2093
It requires a fair bit of scripting. Here's an example for the interact mode:

Code: ags

// main global script file

int interactwith=-1; // declare interact queue


function on_mouse_click(int button) {

  interactwith = -1; // stop queued interact commands (put before ProcessClick)

  //...
}

export interactwith; // export interact queue for use in rooms


// Main header script


import int interactwith; // import interact queue for use in rooms


// room script file

#define ID_BLUECUP  201 // define object 1 id for interact queue


function room_a() {
  // script for room: Repeatedly execute

  //...

  if (character[GetPlayerCharacter()].walking == 0) { // if player has stopped walking
    if (interactwith != -1) { // if he was set to interact with something
      if (interactwith == ID_BLUECUP) { // if he was to interact with object 1 (blue cup)
        ObjectOff(1); // remove object 1 from room
        AddInventory(22); // add inventory item for object 1
      }
      // ...more objects here
      interactwith = -1; // reset interact queue
    }
  }

  //...
}


function object1_a() {
  // script for object1: Interact with object

  MoveCharacter(GetPlayerCharacter(), GetObjectX(1), GetObjectY(1)); // start moving player character to object
  interactwith = ID_BLUECUP; // put object 1 in interact queue

}



The use of the ID_BLUECUP definitions is because characters are handled the same way in the global script, so if you were to put the object number in the interact queue (for example 1), it could also mean character 1 (or hotspot 1 in room scripts).
That's why I use IDs 100-199 for hotspots, IDs 200-299 for objects and IDs 300-399 for characters. These numbers are arbitrary, so you could just use higher numbers if you have a lot of characters. It's only important that all characters/objects/hotspots have unique IDs for the queues.
#2094
Right, I've created some copies and file 5 is named XE859B~1.MP3, file 6 XE8597~1.MP3. Weird.
The best solution seems to be to have PlayMP3File support long(er) filenames...
#2095
The 8+3 filenames are xerxes~1.mp3, xerxes~2.mp3 and so on.
You can display these filenames if you open a dos prompt and type
dir /x
#2096
Well, in his question he said it would be more comfortable and easier to work with, so I guess my suggestion is valid.
#2097
- Click the door hotspot's "Interaction..." button.
- Double-click "Use inventory on hotspot".
- Choose "Run script".
- Click "Edit script..."
- Put this script in there (modify to your needs):
Code: ags

if (character[GetPlayerCharacter()].activeinv == YOURKEYINVITEMNUMBERHERE) { // if key used
  LoseInventory(YOURKEYINVITEMNUMBERHERE); // remove key from inventory
  NewRoom(YOURROOMNUMBERHERE); // go to new room
}
else { // if something else used on hotspot
  DisplaySpeech(GetPlayerCharacter(), "That doesn't work.");
}


There's also an interacton editor-only way, but I think scripting is easier.
#2098
You have to be more specific with what you want to do exactly.

With script, you can move characters using the MoveCharacter function, it's non-blocking.
If you're using the interaction editor, select "Character - Move Character" and be sure to set "Wait for move to finish" to False.

If you want to move a character along a path, use the MoveCharacterPath function.

If you want characters continually walking in the background, use the following code for reference:

Code: ags

function room_a() {
  // script for room: Repeatedly execute

  //...

  if (character[SOMEGUY].walking == 0) { // character has stopped walking (reached point C)
    MoveCharacterDirect(SOMEGUY, 0, 100); // walk to point A
    MoveCharacterPath(SOMEGUY, 160, 150); // then to point B afterwards
    MoveCharacterPath(SOMEGUY, 320, 100); // then to point C
  }

  /...
}


It's all very well explained in the manual. Read it carefully, it's excellent.
#2099
AGS doesn't support decimals, so integers will automatically round up/down.
#2100
function WaitMS(int milliseconds) {
  int gameloops = (GetGameSpeed() * milliseconds) / 1000;
  if (gameloops == 0) gameloops = 1;
  Wait(gameloops);
}

(Edited to avoid Wait(0))
SMF spam blocked by CleanTalk