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

#21
Hi I'm having a go with updating the DOTT template to use with ags 2.72, I'm wanting to use the enforce object based scripting and enforce new style strings and was wondering how you upate the following code.
Code: ags

function SetPlayer(int charid){
Ã,  //use this instead of SetPlayerCharacter function for switching to other players
Ã,  int counter=1;
Ã,  while (counter<MAX_PLAYERS){
Ã,  Ã,  if (charid==Tposition[counter].charac){
Ã,  Ã,  Ã,  SetButtonPic(MAINGUI,Tposition[counter].smallpicbutton,1,Tplayer[GetPlayerCharacter()].smallpic);
Ã,  Ã,  Ã,  Tposition[counter].charac=GetPlayerCharacter();
Ã,  Ã,  }
Ã,  Ã,  SetButtonPic(MAINGUI,Tposition[counter].smallpicbevelbutton,1,Tplayer[charid].smallpicbevel);
Ã,  Ã,  counter++;
Ã,  }
Ã,  Tposition[0].charac=charid;
Ã,  counter=0;Ã,  Ã, 
Ã,  while (counter<MAX_MODES){
Ã,  Ã,  if (Tmode[counter].button[charid]>=0) SetButtonPic(MAINGUI,Tmode[counter].button[charid],2,Tmode[counter].highlightedbutton[charid]);
Ã,  Ã,  counter++;
Ã,  }
Ã,  SetLabelColor(ACTION,0,Tplayer[charid].actionlabelcolor);

Ã,  Tplayer[GetPlayerCharacter()].topinvitem=game.top_inv_item;
Ã,  if (Tplayer[charid].topinvitem>=0) game.top_inv_item=Tplayer[charid].topinvitem;

Ã,  SetCharacterClickable(GetPlayerCharacter(),1);
Ã,  SetCharacterClickable(charid,0);
Ã,  StopMoving(GetPlayerCharacter());
Ã,  SetPlayerCharacter(charid);
Ã,  SetMode(DEFAULT);

}


I get an error with the "SetButtonPic" undefined token.
Any help would be grateful
#22
This module will be the final version unless there is any problems.

The FadingThingsNonBlocking will be a seperate module that can be used along side of this module.(They are not dependant on each other).

It will have the ability to have a better speed control (minus figures to speed up or postive numbers to slow down.

A timer control to allow staggered fading ie.. if an object is say two seconds into fading you can the start another object, character or Gui to fade. Or to have all objects, Characters and Gui's to fade at the same time.

Still in the testing stages until I am happy it's okay to release.
#23
Thanks for the replies.

Hopefully coming soon.

I'm in the process of fixing some bugs for my other module which will be "FadingThingsNonBlocking"

The module will allow for upto and including 500 different Objects, 500 different Characters and 500 different Gui's to be faded in/out simultaneously or staggered with the timer control. PER ROOM
#24
This module will be replacing my previous module called "Fading Objects & Characters" as I've now updated it.

This module will now Fade in/out Objects, Characters and Gui's

FadingThings.zip
Current version:- 2.25

Requirements:- AGS 2.70 +

This module uses the script O-names for all the commands.

This Module is for fading Objects, Characters & Gui's with a blocking function, in that you have to wait for these functions to finish before something else happens.

Commands:-
Code: ags

FadeObjectOut(oWax, 100, 1);
FadeObjectIn(oWax, 0, 1);

FadeCharacterIn (cEgo, 0, 1); 
FadeCharacterIn (cEgo, 0, 1, 100, 150); 
FadeCharacterOut (cEgo, 100, 1); 

FadeGuiOut(gMaingui, 100, 1);
FadeGuiIn(gMaingui, 0, 1);


TRANSPARENCY: -
Fade Objects, Gui's & Characters In/Out by value which can be any value between 0 and 100.
0 = visible
50 = ghost
100 = invisible

SPEED: -
Set speed of Fading can be set from 1 upwards, setting 0 (Zero) or minus numbers will default to one.
-10 = Defaults to 1
   0 = Defaults to 1
   1 = normal
   2 = slow
   3 = slower etc..
-----------------------------------------------------------------------
Objects & Gui's with a transparency of 100 will be turned off automatically
NPC Characters with a transparency of 100 will be moved to room(-1). But NOT the player Character.

*Edit*
With regards to the player Character if it's transparency = 100
they will stay in the current room totally invisible.

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

OBJECTS: -
Objects now don't need to be ticked visible and have transparency set to 100 before use.
Instead you can leave the objects unticked so they are turned off, and then just use the FadeObjectIn function as turning an object on is dealt within the function.

FadeObjectOut(oWax, 100, 1);
Will fade out the object totally invisible with normal speed.

FadeObjectIn(oWax, 0, 1);
Will fade in the object totally visible using normal speed.
-----------------------------------------------------------------------

CHARACTERS: -
If characters are starting in room 5 for example you will have to set that characters transparency in that room, using a run-script under (Before Fadein) e.g.

character[EGO].Transparency =100; // Invisible

Or you can have that character to start in room (-1) and just use the FadeCharacterIn function and all transparencies are dealt with e.g.

Commands:-
FadeCharacterIn (cEgo, 0, 1);
This will fadein character EGO totally visible using normal speed.

Also you can set where if needed the X and Y position of a character when fading in, this is an optional command, so you don't need to set these if you want to use the previous coordinates.
e.g.

FadeCharacterIn (cEgo, 0, 1, 100, 150);

This will fadein character EGO totally visible using normal speed and place the character at the new given co-ordinates.
-----------------------------------------------------------------------

GUI's
Added the ability to fade in/out gui's

Commands:-
FadeGuiOut(gMaingui, 100, 1);
Will fade out the gui totally invisible with normal speed.

FadeGuiIn(gMaingui, 0, 1);
Will fade in the gui totally visible using normal speed.
-----------------------------------------------------------------------
-----------------------------------------------------------------------

Version History:

2.25 Added check so zero or negative numbers for Speed defaults to one.

2.24 Renamed module from "Fading Objects & Characters" to "FadingThings".

2.23 Added functions for fading Gui's in/out.
#25
Thanks for the reply
I've just added fading gui's to the module and before releasing the update. I was wondering if it was possible.
Thanks again.
#26
Hi
I've been adding to my fading module and was wondering
if it was possible to be able to fade in/out inventory items?

I've had a go, but I keep getting
"Transparency is not a public member of inventoryitem"

Here's my last attempt
Code: ags

struct FadeThing {Ã,  Ã, // Setting up a struct.
Ã,  int Transparency;Ã,  //
};

FadeThing Item;
InventoryItem *FadeII; 


function FadeInventoryItemOut (InventoryItem *II, int Value, int Speed) {

 FadeII = II;

 Item.Transparency = FadeII.Transparency;

Ã,  while (Item.Transparency < Value) {
Ã,  Ã, Item.Transparency ++;Ã,  Ã, 
Ã,  Ã, Wait (Speed);
Ã,  Ã, }
Ã,  if (Item.Transparency == 100) {Ã,  // Removes Item if Transparency = 100
Ã,  Ã,  Ã,  player.LoseInventory(FadeII);
Ã,  Ã, }
 }


Any ideas would be grateful.

#27
I've now found the right zip as this one allows any character using the script o-name to face different directions

FaceRight2.zip

Code: ags

Face(cEgo, Left);
Face(cEgo, Up);
Face(cEgo, Right);
Face(cEgo, Down);

#28
The third module is: Teleport

Teleport.zip

This zip comes with two versions
The first version uses the characters script name and object number ie.

Code: ags

TeleportCharacter(EGO,100,110);
TeleportObject(1,100,110);


The second version uses the character script o-name ie.

Code: ags

TeleportCharacter(cEgo,100,150);
TeleportObject(oWax,100,115);



Teleport Characters or Objects anywhere within same room.

Requirements:-Ã,  AGS 2.70 +

This module allows you to instantly move characters and objects around the screen as if being teleported.

The first function uses the character script '0' name, X and Y are the co-ordinates to
teleport the character too. see example below

TeleportCharacter(cJoe,100,60);
TeleportCharacter(Script name, X position, Y postion);

The second function uses the object script '0' name, X and Y are the co-ordinates to
teleport the object too. see example below

TeleportObject(oWax,100,60);
TeleportObject(Script o-name, X position, Y postion);
#29
The second module is :Fading Objects & Characters

Superseded by the FadingThings module.
#30
The first module is:Face Right2

FaceRight2.zip


Requirements:-  AGS 2.70 +

This idea was taken from one of the demo games, which I no longer have.
So I am unable to remember who the author was.

This module allows you to turn characters so they face a certain direction without using coordinates.

Examples:-
Code: ags

Face(cEgo, Left);
Face(cEgo, Up);
Face(cEgo, Right);
Face(cEgo, Down);

Face(cRoger, Left);
Face(cRoger, Up);
Face(cRoger, Right);
Face(cRoger, Down);


#31
One thing I have noticed is with the status line,
in that for example. If you give a character an inventory item and this in turn causes the player to change room, in the new room it will briefly show that you have given an inventory item to a character.

So what I then did was to give the status label a script name "lblStatus" and then add to the on event function the following:
Code: ags

function on_event (int event, int data) {//////////////////////////////////////On Event/////////////////////On Event
Ã,  if (event == eEventEnterRoomBeforeFadein) player.PlaceOnWalkableArea();

Ã,  else if (event == eEventLeaveRoom) { // Reset Label to "walk to".
Ã,  Ã,  SetDefaultMode(WALK);
Ã,  Ã,  lblStatus.Text = ("Walk to");
Ã,  }

}


which seems to have solved the problem.
#32
I had a quick look using 2.72, I also had the same error only it was with line 428.
Code: ags

ViewFrame *vf2=Game.GetViewFrame(CURSOR, 0, counter/DELAY);


So I then chaged it too :
Code: ags

ViewFrame *vf2=Game.GetViewFrame(CURSOR,0,1);

This may not be right, but for now it seems to work.
#33
With regards to the voodoo doll interactions yes your quite right it is in the 2.70 version. (Slaps face repeatedly)
And maybe that should have been taken out.

*Edit* The example shown with the voodoo doll uses the drop down menu conditional and it's this that doesn't kick in the unhandled event for other inventory items used on it.*

With reagrds to the
Code: ags

if (MainInventory.TopItem > 0){Ã,  Ã,  Ã, //if invent. can scroll up 
Ã,  Ã,  gMaingui.Controls[9].AsButton.NormalGraphic=INV_UP_ARROW_ON_SPRITE;
Ã,  }
Ã,  else //if can not scroll up
Ã,  Ã,  gMaingui.Controls[9].AsButton.NormalGraphic=INV_UP_ARROW_OFF_SPRITE;Ã,  Ã, 
Ã,  if (MainInventory.TopItem < MainInventory.ItemCount - (MainInventory.RowCount*MainInventory.ItemsPerRow))Ã,  Ã, //if invent. can scroll down 
Ã,  Ã,  gMaingui.Controls[10].AsButton.NormalGraphic=INV_DOWN_ARROW_ON_SPRITE;Ã,  
Ã,  elseÃ,  // if can not scroll down
Ã,  Ã,  gMaingui.Controls[10].AsButton.NormalGraphic=INV_DOWN_ARROW_OFF_SPRITE;
//-----------------------------------------------------
}



that was to show anyone else looking where you had named the inventory box.

#34
Hi SSH
Good work on the updating.
I was going to ask you if you had sorted out the unhandled event for inventory items on other inventory items as with the 2.70 version they didn't always work.

I thought when testing your version you had the same problem, but what I found with your example with the "needles" inventory was that you were missing the unhandled function it should read like:

Code: ags

Ã,  Ã,  if (UsedInvMode(USE,3)){ // (mode used,inventory number)
// Display ("Chachipiruli");Ã,  
player.LoseInventory(inventory[1]);
player.LoseInventory(inventory[3]);
player.AddInventory(inventory[2]);
}

else Unhandled(); // <---


I also found the interactions for the "voodoo doll" example you show doesn't work if other inventory items are used on it. So it's better to use the above example.


Also you might want to comment out the
Code: ags

#define FIRST_INV_SLOT_COORDS


As you have named the inventory box so when moving the gui's around you don't need to set new coordinates for it.

Code: ags

Ã,  if (MainInventory.TopItem > 0){Ã,  Ã,  Ã, //if invent. can scroll up 
Ã,  Ã,  gMaingui.Controls[9].AsButton.NormalGraphic=INV_UP_ARROW_ON_SPRITE;
Ã,  }
Ã,  else //if can not scroll up
Ã,  Ã,  gMaingui.Controls[9].AsButton.NormalGraphic=INV_UP_ARROW_OFF_SPRITE;Ã,  Ã, 
Ã,  if (MainInventory.TopItem < MainInventory.ItemCount - (MainInventory.RowCount*MainInventory.ItemsPerRow))Ã,  Ã, //if invent. can scroll down 
Ã,  Ã,  gMaingui.Controls[10].AsButton.NormalGraphic=INV_DOWN_ARROW_ON_SPRITE;Ã,  
Ã,  elseÃ,  // if can not scroll down
Ã,  Ã,  gMaingui.Controls[10].AsButton.NormalGraphic=INV_DOWN_ARROW_OFF_SPRITE;
//-----------------------------------------------------
}


Thats my findings at present I'll keep testing it.

Keep up the good work

Lazarus
#35
When using the "mouse.Mode=eModeWalkto" anywhere it didn't work in resetting to the walk command I still had to click else where on the screen for it to change back.
It seems to remember that its holding an inventory item after it's been used on an object or hotspot.
#36
Beginners' Technical Questions / Using Arrays
Thu 13/04/2006 10:32:54
Hi I got this function that I want to turn into arrays, but don't know how.
Code: ags
int transparent2, fadespeed2, fadecounter2, fadelimit2, fadeout = 0; // Fade Out

//----------------------------------------------------------------
Object *fadeobj2; // Fade Out
//----------------------------------------------------------------

function FadeObjectOut (Object *objectpoint,int value,int speed) {
Ã,  if (fadeout) return 1; //aborts if fadeout is currently being executed
Ã,  fadeobj2 = objectpoint;
Ã,  transparent2 = fadeobj2.Transparency;
Ã,  fadeout = 1;
Ã,  fadespeed2 = speed;
Ã,  fadecounter2 = speed;
Ã,  fadelimit2 = value;
} // function end

//----------------------------------------------------------------
function repeatedly_execute_always() {

// fade object out
Ã,  if (fadeout) {
Ã,  Ã, if (transparent2 < fadelimit2) {
Ã,  Ã,  Ã,  fadecounter2 --;
Ã,  Ã,  Ã,  if (fadecounter2 < 0) {
Ã,  Ã,  Ã,  Ã,  fadecounter2 = fadespeed2;
Ã,  Ã,  Ã,  Ã,  transparent2 ++;
Ã,  Ã,  Ã,  Ã,  fadeobj2.Transparency = transparent2;
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  } else fadeout = 0;
Ã,  Ã,  }
//----------------------------------------------------------------

//----------------------------------------------------------------

function on_event (EventType event, int data) {
Ã,  if (event == eEventLeaveRoom && fadeout) {
Ã,  fadeout = 0;Ã,  //reset, so won't crash in next room
Ã,  fadeobj2.Transparency = 0;
Ã,  }

//----------------------------------------------------------------

} // function on_event end


I can set the first bit:
Code: ags
int transparent2[10], fadespeed2[10], fadecounter2[10], fadelimit2[10], fadeout = 0; // Fade Out
//----------------------------------------------------------------

Object *fadeobj2[10]; // Fade Out
//----------------------------------------------------------------


But how do you assign each array element, so when a figure is added it fills the first array, but when a second is added it then fills the second element and so on?

any ideas would be grateful
#37
I've tried your suggestion with "mouse.Mode=eModeWalkto" between each line and it didn't seem to work.

Also looking at the braces they all seem to be there, I've numbered them for ease to look at:
Code: ags
 if (button == eMouseLeftInv) { //1
Ã,  Ã,  Ã, InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
Ã,  Ã,  if (player.ActiveInventory == null) { //2
Ã,  Ã,  Ã,  if ((StrComp(verb, vGive) != 0) && (StrComp(verb, vUse) != 0)) { //3
Ã,  Ã,  Ã,  Ã, if (item != null)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  item.RunInteraction(mouse.Mode);
Ã,  Ã,  Ã,  Ã, } //3
Ã,  Ã,  Ã,  Ã, else { //4
Ã,  Ã,  Ã,  Ã,  if (StrComp(verb, vUse) == 0)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (item.IsInteractionAvailable(eModeInteract) == 1) { //5
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  item.RunInteraction(mouse.Mode);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  return;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, } //5
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, player.ActiveInventory = item;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, mouse.Mode = eModeUseInv;
Ã,  Ã,  Ã,  Ã,  Ã,  } //4
Ã,  Ã,  Ã,  Ã,  } //2
Ã,  Ã,  Ã,  Ã, else { //6
Ã,  Ã,  Ã,  Ã,  Ã, if (item != null)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, item.RunInteraction(mouse.Mode);
			Ã,  Ã,  } //6
 } // function end //1


If I put a brace at the end of
Code: ags
if (StrComp(verb, vUse) == 0) {

where would I then Put a closing brace? I tried putting the closing brace before closing brace number 4 which didn't work and if also stop the giving command to work.
#38
Hi at present I'm using:
Code: ags
 if (button == eMouseLeftInv) {
Ã,  Ã,  Ã, InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
Ã,  Ã,  if (player.ActiveInventory == null) { 
Ã,  Ã,  Ã,  if ((StrComp(verb, vGive) != 0) && (StrComp(verb, vUse) != 0)) {
Ã,  Ã,  Ã,  Ã,  if (item != null)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  item.RunInteraction(mouse.Mode);
Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  Ã, else {
Ã,  Ã,  Ã,  Ã,  Ã,  if (StrComp(verb, vUse) == 0)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (item.IsInteractionAvailable(eModeInteract) == 1) {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  item.RunInteraction(mouse.Mode);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  return;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, player.ActiveInventory = item;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, mouse.Mode = eModeUseInv;
Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã, else {
Ã,  Ã,  Ã,  Ã,  Ã, if (item != null)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, item.RunInteraction(mouse.Mode);
			Ã,  Ã,  }
 } // function end


The problem I have is that when using an inventory item it doesn't return back to the walkto mode after use, you have to then click again somewhere else to return back to the walk mode.

Is there a way so this happens after the interaction has happened?

Thanks in advance
#39
I've just found this tutorial and was wondering how you go about defining unhandled responses for "using an inventory item" and "giving an inventory item"

I've tried several ways but I can't quite get it right here's my last attempt:
Code: ags
Ã,  else if ((StrComp(verb, vGive) == 1) && (StrComp(verb, vUse) != 0)) {
Ã, Ã,  Display("I don't want to give that to %s.", locname);
Ã, Ã,  }
Ã,  else if ((StrComp(verb, vUse) == 1) && (StrComp(verb, vGive) != 0)) {
Ã, Ã,  Display("I can't use that on %s.", locname);
Ã, Ã,  }


#40
That sort of works, but when selecting an inventory item and then using it on nothing the give mode doesn't change back to the walk mode or if I right clicked on an object say to look at something.

Also on another note is there a way of setting up the unhandled events for if mouse modes were used for example:
Code: ags
	string locname;
	string invname;
GetLocationName(mouse.x,mouse.y,locname);
Ã,  Ã, 

 if (mouse.Mode==eModeInteract) {
Ã,  Ã, Display("I can't use that");
Ã,  Ã, }
 else if ((mouse.Mode==eModeUseInv)&&(type==3)) {
Ã,  Ã, Display("I can't use the %s with the %s.", invname, locname);
Ã,  Ã, }
 else if ((mouse.Mode==eModeGive)&&(type==3)) {
Ã,  Ã, Display("I rather keep it.");
Ã,  Ã, }

 else if ((mouse.Mode==eModeLookat)&&(type==0)) {
Ã,  Ã, Display("Nothing special with it.");
Ã,  Ã, }
 else if (mouse.Mode==eModePickup) {
Ã,  Ã, Display("I'm picking that up.");
Ã,  Ã, }
 else if (mouse.Mode==eModeTalkto) {
Ã,  Ã, Display("Speaking with %s is a waste of time.", locname);
Ã,  Ã, }
 else if (mouse.Mode==eModePull) {
Ã,  Ã, Display("Pulling that is a waste of time.");
Ã,  Ã, }
 else if (mouse.Mode==eModePush) {
Ã,  Ã, Display("Pushing hat is a waste of time.");
Ã,  Ã, }
 else if (mouse.Mode==eModeOpen) {
Ã,  Ã, Display("I can't open it.");
Ã,  Ã, }
 else if (mouse.Mode==eModeClose) {
Ã,  Ã, Display("I can't close it.");
Ã,  Ã, }


as I wanted different reactions between using an inventory item and giving an inventory item.
SMF spam blocked by CleanTalk