View Problems

smartguy240 >:( 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!

[glow=red,2,300][color=Yellow]IT IS DRIVING ME NUTS!!!![/color][/glow]
AGI1122 Just set up a flag to check if the object should be there or not like this:


if (!fN) {
AGI1122 Also as an alternative you could use this:

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. :)
smartguy240 [color=black][glow=yellow,2,300]THANKS It WoRKED![/glow][/color]
smartguy240 :-\ OK, I have a new question.


I have tried

[glow=red,2,300]THOUSANDS AND THOUSANDS[/GLOW]of 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?

[color=LimeGreen][glow=red,2,300]I AM CLUELESS!!![/glow][/color]

SMG240
AGI1122 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.
smartguy240 [glow=red,2,300]Thank you! That Worked too![/glow]
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

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

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

that is basically my question.

besides that, thanks!


SMG240
Joel 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


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.
Joel also, if the sword is a stationary object, you might want issue the command stop.cycling(o8) , just to be sure.
Robin_Gravel 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
smartguy240 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?
Robin_Gravel 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
Joel 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.
sonneveld 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


smartguy240 :-\
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
[glow=red,2,300]( supposedly, I cant tell because my inventory is all screwed up! What is that all about? It looks like this:sodughpaiosuvpaw085u0)(*u(%_870Np(&^_#%(&!)[/glow]! 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





smartguy240 [glow=red,2,300]Message 15 WOW! We are now a Hot Topic, kind of like the store![/glow] 8)
AGI1122 15 isn't really that big of an ammount of replies. I have seen some with above 300 replies but not at this board though...
smartguy240 Oh...well... :-\ ... I thought it was special...
smartguy240 :-\ Well joel, I tried yours too and It didn't effect (or mabye affect?) my view's disapearance.

Maybe it is me ??? Who knows ???.

smartguy240 Hey Chris, I really couldn't help but wondering,
what is your member picture thing of?
Andrew_Baker The garbage characters you're getting in your inventory may be the result of using an old save game after changing some code. There's a couple older threads on this board on that topic.

The first block of code in any logic is the initialization. That's why it's headed if (new_room) {...}. Any code to be executed when the character enters a room should be placed here. This is where your object_in_room? test should be placed.

Also, remember that AGI is a cantankerous old shrew of a proprietary scripting language designed for an abandoned platform (IBM PCjr). It is full of all kinds of strangeness. Therefore, know in your heart that you only ask questions any beginner would have.

Hope all that helps.
AGI1122 I am into giant fighting robots(sort of like nukem dukem robots from SQ3) that is called a Gundam, it is from a japanese anime series called Gundam Wing. That one is the Death Scythe(my favorite one) I host it on my server so it isn't one of the user pics here at the board.

I also have this one , it is called the eypon and it too is from the Gundam Wing series. I have these plus a whole bunch more for my avatars at my new message board here. and a few AGI characters and other various things like Mega Man doing a funny dance.

Well anyway if you want to check out the gundam stuff it is at http://www.gundamofficial.com
smartguy240 THNKZ Andrew_Baker
that does help! 8)

SMG240
smartguy240 Chris,
OHHHHH! That is what I thought that It was but I couldnt tell! I kinda watched that when it was on (it is off air isn't is?) but I couldn't watch it much because I don't have cable! :-
AGI1122 Yeah Gundam Wing isn't on the air anymore. Infact I don't think any of the gundam series are on the air anymore. But I have some of the series on video. :)

I also have 2 of the dvd/movies as well: Gundam Wing: Endless Waltz and Gundam Saviour.

Gundam Saviour was really good, they used CG graphics on the gundam so instead of the anime look it has a more realistic look. Plus they used real actors with sets. :)

I also like to build the models of the gundam, I just built the High Grade version of the Heavy Arms custom. I also have some views of gundams drawn up and am planning on making a gundam game in SCI and maybe a AGI version as well. :)
Joel Are you sure you're not executing a draw(sword); command anywhere else? By the way, what I meant was for that code to appear in the new_room section of the logic as well, as in: if (new_room) { // other new_room code here if (obj.in.room("sword", room_no)) { // all the stuff in here } } I don't think it's you that's the problem. But if what I suggested doesn't work then there's a good chance that there's something else you're doing in your code that we can't see that's causing the problem, because I used that code in my game and it works ok. Did you also make sure to execute a get("sword") command in the if (said("get", "sword")) section?
smartguy240 Wait a minute... is the obj.in.room the same as draw()?
I only have draw() once and i put that on top of the command block and tried to test it.

When I got the sword, it erases, but if I leave the room, and come back, the original sword is there! Is there any comand like


if(has("sword")); {
erase(o8);
}

or anything like that , that I could enter in to the initialization?

SMG240
AGI1122 if(has("sword")); {
erase(o8);
}

Yes that would work, but why make extra code just don't draw it in the first place by using

if (!has("sword")) {
draw(08);
}

This way it will draw the sword if you don't have it and if you do have it then it will never be drawn in the first place. I would also add the load.view(n); and all that stuff in there so that the game won't load it unless it is supposed to be drawn:

if (!has("sword")) {
animate.obj(08);
load.view(20);
set.view(o8,20);
draw(o8);
}

This is how I would go about it.
smartguy240 :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)

[glow=red,2,300]IT WORKED!!!! THANK YOU!!! YIPEE!![/glow]

...
It worked Chris! Thanks a million!

SMG240
Joel if it works, that's cool -- however, I think I should point out that the obj.in.room solution is basically the same thing. You should only draw the object if obj.in.room is true. If you were doing something like this:


draw(sword);

if (obj.in.room("sword", room_no))
{
// whatever here
}


then that's why your code wasn't working before. The draw(sword) should only appear like this:


if (obj.in.room("sword", room_no))
{
draw(sword);
}
AGI1122 Sure no problem, glad to help.
smartguy240 Thank You everybody who helped me out on this message board thing. When my game is complete, I will be sure to send a copy to someone! ;D