Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411507 Posts in 69379 Topics- by 58435 Members - Latest Member: graysonsolis

April 30, 2024, 10:50:23 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsBanshee Engine : For all your ANSI needs!
Pages: 1 ... 10 11 [12] 13 14 15
Print
Author Topic: Banshee Engine : For all your ANSI needs!  (Read 34719 times)
DustyDrake
Level 10
*****



View Profile
« Reply #220 on: February 08, 2013, 08:24:18 PM »

So it's still like the entitydataread and save?
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #221 on: February 08, 2013, 08:26:35 PM »

No. Now you can do getentityglobal(player,"pos") without doing anything beforehand except declaring that global variable in the player script. (And if it hasn't been declared you just get a nil back.)

player.lua:
Code:
function initialized()
pos=10
if code==14 then code=code+2 end
end

main.lua:
Code:
function main()
print(getentityglobal(player,"pos"))
end

console/log output:
Code:
16

This *should* work even with tables.
« Last Edit: February 08, 2013, 08:33:14 PM by _Madk » Logged
DustyDrake
Level 10
*****



View Profile
« Reply #222 on: February 08, 2013, 08:29:31 PM »

Declaring it like so?
setentityglobal( this, "pos", value )
Or can I use pos = value?
Because if not it's exactly like entitydataread/save.
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #223 on: February 08, 2013, 08:34:14 PM »

See the more information I edited into the previous post. It really is not at all like entitydataread/save.
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #224 on: February 08, 2013, 08:54:10 PM »

Declaring it like so?
setentityglobal( this, "pos", value )
Or can I use pos = value?
Because if not it's exactly like entitydataread/save.
In the simplest terms - from inside the entity in question, you just access the variable in question with "pos = value". From outside the entity in question, it's like entitydataread/save.

It pretty much just saves a few calls. Doesn't make manipulation from outside the entity's script any easier if that was what you were getting at.
Logged

DustyDrake
Level 10
*****



View Profile
« Reply #225 on: February 08, 2013, 09:04:10 PM »

I just needed to get the value of that variable.
However now I'm apparently getting issues with getentityx() not working.
I gotta look into how I'm making the entity in question before I call broken though.

Edit: Yep, I put entitygetx, instead of getentityx

Edit: Argleblarg, the stupid enemy is solid even after I use setentitysolid(this,0)
« Last Edit: February 08, 2013, 09:13:54 PM by DustyDrake » Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #226 on: February 08, 2013, 09:27:19 PM »

Edit: Argleblarg, the stupid enemy is solid even after I use setentitysolid(this,0)

Solid only applies to collision with other entities, not with the map. (Should probably do something to make not colliding with the map ok, though.) If collision with the map is the problem maybe try using positional commands that ignore the map mask?
Logged
DustyDrake
Level 10
*****



View Profile
« Reply #227 on: February 08, 2013, 10:38:41 PM »

It's an entity I want to not be solid. Do both have to be set to notsolid?
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #228 on: February 09, 2013, 06:37:16 AM »

It's an entity I want to not be solid. Do both have to be set to notsolid?

Nope. Can I see where you're setting the entity to not-solid?
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #229 on: February 09, 2013, 06:43:13 AM »

Having a really bizarre problem. I tried to add to the Captain's Log so that it prints the objective on startup. This is in initialize().

Code:
mission = dataread("mission")
print("mission" .. tostring(mission))
if mission == 0 then
datasave(tostring(cc), "ELIMINATE")
print(dataread(cc))
datasave(tostring(cc) .. "sym", 19)
cc = cc + 1
print("mission confirmed" .. cc)
end

And it doesn't print. It prints everything else but that. But here's the weird part. This is my log:

Code:
09/02/13 - 09:39:40 AM : SCRIPT: "C:/Users/Matt/Documents/Banshee Engine/banshee - ANSISubGame/ansisubgame/scripts/playermain.lua": mission0
09/02/13 - 09:39:40 AM : SCRIPT: "C:/Users/Matt/Documents/Banshee Engine/banshee - ANSISubGame/ansisubgame/scripts/playermain.lua": ELIMINATE
09/02/13 - 09:39:40 AM : SCRIPT: "C:/Users/Matt/Documents/Banshee Engine/banshee - ANSISubGame/ansisubgame/scripts/playermain.lua": mission confirmed1

It's set up IDENTICALLY to the other code dictating the usage of the Captain's Log.
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #230 on: February 09, 2013, 07:06:45 AM »

I'm confused what the issue is. It looks like it does what it's supposed to.

Just to be sure: you know that "print" only outputs to the console/log, right? To put it on the screen you'll need to use drawstring or drawtext.
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #231 on: February 09, 2013, 07:09:15 AM »

Just to be sure: you know that "print" only outputs to the console/log, right? To put it on the screen you'll need to use drawstring or drawtext.
Yes. I know that. I did build a HUD that involves drawing lots of text. The print statements were to make sure everything was going through correctly, which it APPEARS to be doing.

My problem is that the HUD isn't printing that statement. Even though cc = 1 at the end and the place for cc = 0 in global data prints "ELIMINATE" like it's supposed to, it does not show up in the place where the HUD code says to print dataread(cc-1).

EDIT: To be clearer, for some reason, ALL of the code related to the Captain's Log works...except that. And that is in the initialize() function which is the only thing it doesn't share with the rest of the code. Otherwise it's almost identical.

EDIT2: And I fixed it by modifying the number gained from this operation after it was set but this gives me an access violation error apparently and I'm a bit confused as to why.

Code:
local cxmax = getmapwidth(getentitymap(this)) - 39
« Last Edit: February 09, 2013, 07:27:00 AM by johnki » Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #232 on: February 09, 2013, 10:09:18 AM »

EDIT2: And I fixed it by modifying the number gained from this operation after it was set but this gives me an access violation error apparently and I'm a bit confused as to why.

Reeks of an engine bug. Can you send me what you've got?
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #233 on: February 09, 2013, 10:33:27 AM »

Currently working on a massive upgrade to the documentation.
Logged
DustyDrake
Level 10
*****



View Profile
« Reply #234 on: February 09, 2013, 11:23:34 AM »

It's an entity I want to not be solid. Do both have to be set to notsolid?

Nope. Can I see where you're setting the entity to not-solid?

Both when I initialize the enemy and when it's draw function is called:
Code:
function initialized()
setentitysolid(this, 0)
end

function draw_self()
local dist = getentityglobal(player,"pos")
setentitysolid(this, 0)
if(dist < 15) then
drawset(2,3,19)
drawtile(getentityx(this),getentityy(this))
end
end

Actually that reminds me, for some reason I can't use getentityglobal(player,"pos") - pos
Might be because I used entitydatasave for that variable, so I'll check on that.
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #235 on: February 09, 2013, 02:29:10 PM »

setentitysolid(this, 0)

The function is meant to take a boolean - try setting it to false instead. Lua is prickly and weird about casting numbers to bools and visa-versa.

Actually that reminds me, for some reason I can't use getentityglobal(player,"pos") - pos
Might be because I used entitydatasave for that variable, so I'll check on that.

Yeah, if it's entitydata instead of an Lua global then it's not gonna see it.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #236 on: February 09, 2013, 03:46:25 PM »

Docs in progress.

It's absolutely unstyled at the moment, but it's going pretty well. I think it's a huge improvement.
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #237 on: February 09, 2013, 04:50:48 PM »

Reeks of an engine bug. Can you send me what you've got?
That line after the "EDIT2" with code is the exact line that gave me an access violation.

And I still am lost as to why setting the data during the initialized() function is not allowing me to print said data.
Logged

Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #238 on: February 09, 2013, 05:08:16 PM »

Reeks of an engine bug. Can you send me what you've got?
That line after the "EDIT2" with code is the exact line that gave me an access violation.

And I still am lost as to why setting the data during the initialized() function is not allowing me to print said data.

For me to know precisely what's causing an access violation I pretty much have to be able to run your game in debug mode, and what line of script caused it is mostly irrelevant.  Droop
Logged
pluckyporcupine
Level 9
****


View Profile WWW
« Reply #239 on: February 09, 2013, 05:13:33 PM »

For me to know precisely what's causing an access violation I pretty much have to be able to run your game in debug mode, and what line of script caused it is mostly irrelevant.  Droop
Ah. Sure. Let me upload it and PM you.

EDIT:
And I still am lost as to why setting the data during the initialized() function is not allowing me to print said data.
Still no idea why it wouldn't print (cc is just a pointer to a number and that number - 1 = the global address that is being printed) but doing what I'd done with every other zone and saving cc after adding to it seems to have fixed it.

EDIT2: D'OH! That's what I get for solving the problem right after I wake up. The pointer was increasing but then it was being overwritten (decreased) during the next step by the game syncing the globally saved data to the local variable. THEN when the next text update happened, it would overwrite it.

Ah, makes much more sense now.
« Last Edit: February 09, 2013, 06:12:44 PM by johnki » Logged

Pages: 1 ... 10 11 [12] 13 14 15
Print
Jump to:  

Theme orange-lt created by panic