Author Topic: View Problems  (Read 8259 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrick

View Problems
« on: April 05, 2002, 05:20:44 PM »
>:( I am new to programming AGI games, and everyone is probabaly going to laugh at me for asking this, but...

How do I get my view(object) to erase when I pick it up, leave the next room then come back? I can get the item to dissappear when I am on the screen, but if I leave the room and come back, there sits the object!

IT IS DRIVING ME NUTS!!!!
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »




Offline Chris Cromer

Re: View Problems
« Reply #1 on: April 05, 2002, 05:38:34 PM »
Just set up a flag to check if the object should be there or not like this:

[code]
if (!fN) {
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Chris Cromer

Re: View Problems
« Reply #2 on: April 05, 2002, 06:10:30 PM »
Also as an alternative you could use this:

Code: [Select]
if (obj.in.room("OBJECT_NAME", room_no)) {
 draw(oN);
}


This one I think would be better to use since you wouldn't have to waste a flag. :)
« Last Edit: December 31, 1969, 07:00:00 PM by 1018072800 »
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Patrick

Re:View Problems
« Reply #3 on: April 06, 2002, 03:10:46 PM »
THANKS It WoRKED!
« Last Edit: April 06, 2002, 04:54:33 PM by smartguy240 »


Offline Patrick

Re:View Problems
« Reply #4 on: April 06, 2002, 04:53:13 PM »
 :-\ OK, I have a new question.


I have tried

THOUSANDS AND THOUSANDSof ways to get my object to animate on the screen.
it is called o2, and it is positioned at 100,100, which is in the water (ok, it is a fish). But every time I want my animated object to be on screen, it isn't there

this is in my defines list
#define fish   o2

is that the problem?

I really think that the problem is that I dont know which codes to place in the block of commands.

Do I need any flags, vars, controls, or anything on these commands?

I AM CLUELESS!!!

SMG240


Offline Chris Cromer

Re:View Problems
« Reply #5 on: April 06, 2002, 07:22:57 PM »
Make sure your used animate.obj(02); before you loaded and set the object.

If this doesn't work tell me so that I can think of some other reason it might do that.
Chris Cromer

It's all fun and games until someone get's hurt then it's just fun. ;)

Offline Patrick

Re:View Problems
« Reply #6 on: April 07, 2002, 03:06:16 PM »
Thank you! That Worked too!
Wow, you really are good when it comes to AGI games, and programming!

BUT...

YIKES!!! I tried the first thing that I asked and it worked but then I turned on my computer and it wasn't working.

Where am I supposed to place the [shadow=red,left,300]if(obj.in.room(...[/shadow]
thing?

I am using the format from the template game.

I just dont get why it worked then, but then it didn't!!

Maybe I just wrote it wrong.

here is what I put...

if (obj.in.room("sword", room_no)) {
draw(o8);
}

is that right for my object?

Am I supposed to put this instead of the

draw(o8);

on my command block that I loaded my view into my room? My room number is 6 and I have this on

logic.006

and the command block for placing my object on the screen looks something like this

animate.obj(o8);
load.view(12):
set.view(o8,12);
set.cel(o8,0);
set.loop(o8,0);
set.pri(o8,6);
ignore.blocks(o8);
draw(o8);

do I put the

[shadow=red,left,300]if (obj.in.room("sword", room_no)) {
draw(o8);
}[/shadow]


in there or do I put it in logic 0 or...

that is basically my question.

besides that, thanks!


SMG240


Offline Joel

Re:View Problems
« Reply #7 on: April 07, 2002, 04:01:21 PM »
It would be better to put it in logic 6, I think. In general, it's probably best to have o0 (ego) be the only global object. If you put that code in logic 0, then you're sort of reserving o8 as a global object that always represents the sword. You could write your game so that it did that, and you might be able to get it to work okay, but it would be easier to keep stuff local to the room where it appears as much as possible.

It should work to have the following in logic.006

Code: [Select]

if (obj.in.room("sword", room_no))
{
 animate.obj(o8);
 load.view(12):
 set.view(o8,12);
 set.cel(o8,0);
 set.loop(o8,0);
 set.pri(o8,6);
 ignore.blocks(o8);
 draw(o8);
}


As a side note, you should probably set the loop before you set the cel...that way you can be sure that the cel is actually a valid one.

Offline Joel

Re:View Problems
« Reply #8 on: April 07, 2002, 04:03:48 PM »
also, if the sword is a stationary object, you might want issue the command stop.cycling(o8) , just to be sure.

Offline robingravel

Re:View Problems
« Reply #9 on: April 07, 2002, 04:05:46 PM »
Hi Smartguy.

For best use with obj.in.room command,

First: in object editor, you must set the object which room the player should find the object or it may not work.

put obj.in.room on the room where the object should
be appairs, not room 0.

put obj.in.room on the f5 section (or newroom section if you begin your game using template )

if (isset(f5)){
animate.obj(o8)
.....
if (obj.in.room("Name of your object",v0)){
 draw(o8);
}
show.pic();
}

I hope I helped you.

Robin Gravel

Offline Patrick

Re:View Problems
« Reply #10 on: April 07, 2002, 04:46:01 PM »
You probabally think I am stupid for asking this , but what is v0 and f5?

for f5, does that mean that I place it in the initialization section of the page?

Is v0 the same here that is in my defines.txt from the template?


Offline robingravel

Re:View Problems
« Reply #11 on: April 07, 2002, 06:56:11 PM »
Hi smartguy240

You're not stupid. You are a beginner.

v0 means the room where the ego is in.
The f5 flag is used to initialise the room.

Robin Gravel

Offline Joel

Re:View Problems
« Reply #12 on: April 07, 2002, 06:59:50 PM »
Yes, v0 and f5 are the same as in your defines.txt. I would strongly discourage using those names for them. Use the names defined by the template instead, new_room for f5 and room_no for v0.

Offline Nick Sonneveld

Re:View Problems
« Reply #13 on: April 07, 2002, 10:14:29 PM »
The interpeter has set aside certain variables and flags for it's own purposes.  You usually read them to find out the current state of the interpeter, or set some variables to configure how the interpreter works.

If you look up "special variables" and "special flags" in the agi help file, it will tell you what these are.  The list is almost complete.. at least one flag is missing and one variable hasn't properly been defined.  (the length of the input line I believe)

The "defines.txt" file, which you usually include in each logic file, (like Joel suggests) also gives a symbolic name for each of these variables so you don't have to remember the actual number.

- Nick


Nick Sonneveld  |  AGI Dev  |  NAGI

Offline Patrick

Re:View Problems
« Reply #14 on: April 08, 2002, 05:37:43 PM »
 :-\
Hey, Robin,
I tried your reply and I think that either we had a slight communication error or else I just entered the code in wrong.

when I and my picture wouldn't load when it started.

I will try joel's in awhile and come back.


My original question(edited) was this


When I type in "get _____" the view is erased from the screen and my object is added to my inventory
( supposedly, I cant tell because my inventory is all screwed up! What is that all about? It looks like this:sodughpaiosuvpaw085u0)(*u(%_870Np(&^_#%(&!)! But, if I leave the room and come back, my view will return, but my inventory item wont. So
my question is when I leave a room and come back, how do I get the view to not come back.

Sorry if this was what you wrote me to do, but it wouldnt work for me... ::) ...oh well...

TNKZ
SMG240








SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.073 seconds with 21 queries.