
EDuke32 Scripting "CON coding help"
#1457 Posted 19 April 2014 - 03:59 AM
#1458 Posted 19 April 2014 - 04:01 AM
edit: efb, looks like Helix already has something planned heh heh.
This post has been edited by James: 19 April 2014 - 04:02 AM
#1459 Posted 19 April 2014 - 06:53 AM
James, on 19 April 2014 - 12:09 AM, said:
Thanks, but I tried that and it doesn't work in this case.
Fox, on 19 April 2014 - 12:37 AM, said:
I just tried that but it doesn't work. Checking game mode does what I want.
Helixhorned, on 19 April 2014 - 03:19 AM, said:
By the way, in the "damn I'm good" line, you have a trailing "else":
Fixed.
Helixhorned, on 19 April 2014 - 03:59 AM, said:
Thanks, I'll just wait for the fix to be committed then.
#1460 Posted 19 April 2014 - 09:04 AM
Helixhorned, on 19 April 2014 - 03:59 AM, said:
I've been doing 99% of the work in a separate file, so commit away.
#1463 Posted 22 April 2014 - 02:08 PM
Fox, on 19 April 2014 - 04:28 PM, said:
Who says that? Acutally, I kind of agree that it ought to be invalid in a certain sense, but in point of fact, it's not. What matters is that all events in question are entered with screenpeek as the "current player" (the one that getplayer[THISACTOR] refers to). This is the case for both instances of EVENT_SOUND (from S_PlaySound() and S_PlaySound3D()), as well as DISPLAYMENU and DISPLAYMENUREST, even though the latter two aren't even active when the difficulty sound is requested to be played and thus aren't relevant to the question.
One could object to various circumstances. First, why is player[].gm a player member when it's more like a property of a running EDuke32 instance than that of a player? Also, what meaning is there to EVENT_SOUND always getting screenpeek as the current player? Personally, I consider that event local -- game state must not depend on it being executed. Anyhow, what matters in a single-player setting that the event receives a valid player index at all -- player[0] is guaranteed to be valid even when no game is running, though it may not make sense to examine the values of most of its members then.
#1464 Posted 22 April 2014 - 02:18 PM
Helixhorned, on 22 April 2014 - 02:08 PM, said:
I always assumed that no player existed in such events since per-player variables doesn't work well. I dunno about player structures.
This post has been edited by Fox: 22 April 2014 - 02:18 PM
#1465 Posted 01 May 2014 - 10:59 AM
This post has been edited by MrGlasses: 01 May 2014 - 11:00 AM
#1466 Posted 01 May 2014 - 11:06 AM
// top level gamevar temp 0 0 gamevar temp2 0 0 gamevar flag 0 2 // in your main actor code: getactor[THISACTOR].httimetosleep temp getactor[THISACTOR].statnum temp2 ifvare temp 0 ifvare temp2 1 // STAT_ACTOR { ifvare flag 0 { sound PRED_RECOG setvar flag 1 } }
#1467 Posted 01 May 2014 - 11:26 AM
gamevar TEMP 0 0 onevent EVENT_SOUND ifvare RETURN PRED_RECOG { displayrandvar TEMP 2 ifvare TEMP 1 setvar RETURN PRED_RECOG2 ifvare TEMP 2 setvar RETURN PRED_RECOG3 } endevent
#1469 Posted 01 May 2014 - 11:57 AM
#1470 Posted 01 May 2014 - 01:16 PM
Trooper Dan, on 01 May 2014 - 11:57 AM, said:
Yea, I used Fox's.
#1471 Posted 21 May 2014 - 01:24 AM
This is what I tried to do in my Custom content folder. Do I need to define something in the con files? If so what would I need to do?
// VOC MUSIC/SOUND REPLACEMENTS Sound { ID 400 file "CustomT/CMusic/Music/Voc/barmusic.ogg" } Sound { ID 401 file "CustomT/CMusic/Music/Voc/Mario.ogg" }
#1472 Posted 21 May 2014 - 05:37 AM
Then you need to add them to MUSICANDSFX sprites in the locations you want each individual sound.
#1474 Posted 21 May 2014 - 11:42 AM
NEVERMIND! Fixed dat business. Used the other form of flashlight code by Darkus which avoids this issue.
Woo.
This post has been edited by Commando Nukem: 21 May 2014 - 12:27 PM
#1475 Posted 21 May 2014 - 04:51 PM
I want to display the player's name on screen as part of a new HUD i'm working on. So, whatever the name is for multiplayer, will be displayed on the screen. I can't find anything in the Wiki about this. "Name" was the closest I could find, it and it doesn't do anything.
This is what my code looks like right now:
gamevar NAME 0 1 definequote 254 PLAYERNAME // Just standin definition. onevent EVENT_DISPLAYREST { getplayer[THISACTOR].Name NAME // Name redefinequote 254 %d // Changes quote to display whatever we tell it. qsprintf 254 254 NAME // Print does it's mapping voodoo. gametext STARTALPHANUM 320 10 254 0 0 0 0 0 xdim ydim } endevent
I tried using Idplayers too, and it didn't work either. Is there just no way to do this?
#1478 Posted 22 May 2014 - 10:02 AM
#1479 Posted 22 May 2014 - 12:55 PM
Animated gifs don't automatically become animations in ART. You have to define the tiles separately and set the ART animation value (from defs, the animtilerange command).
The CON files are a scripting language containing elements from C and assembly, so there is no simple solution to what you ask. You just need to program it, and if you don't know programming, learning is the only way.
#1480 Posted 23 May 2014 - 01:47 PM
Right here, I want to project onto the screen the POV of another object. In this instance a pigcop with a palette of 200. I'm sure this will come off as a bit amusing to some of you, but i'm honestly stumped.

gamevar ptemp 0 2 gamevar ptemp2 0 2 // ('squadmate') Camera onevent EVENT_DISPLAYREST { getactor[THISACTOR].picnum ptemp ifvare ptemp PIGCOP getactor[THISACTOR].pal ptemp2 ifvare ptemp2 200 getactor[THISACTOR].x x getactor[THISACTOR].y y getactor[THISACTOR].z z getactor[THISACTOR].ang ang // getactor[THISACTOR].horiz horiz // getactor[THISACTOR].horizoff temp // addvarvar horiz temp updatesectorz x y z sect showviewunbiased x y z ang horiz sect 16 41 56 69 } endevent
Obviously, this is not working. Oh, It does project a view onto the screen, but it's behind the player.
I'm almost certain I need to call the pig stuff in an EVENT_LOADACTOR and then reference it into the EVENT_DISPLAYREST stuff. I was trying that before and it either wasn't showing up, or was just showing a view from the player's feet.
Note, I commented out a few lines that weren't working (for obvious reasons, they reference a camera setup for a player position.)
So, can someone point me in the right direction?
This post has been edited by Commando Nukem: 23 May 2014 - 01:48 PM
#1481 Posted 23 May 2014 - 06:00 PM
Hendricks266, on 22 May 2014 - 12:55 PM, said:
Animated gifs don't automatically become animations in ART. You have to define the tiles separately and set the ART animation value (from defs, the animtilerange command).
The CON files are a scripting language containing elements from C and assembly, so there is no simple solution to what you ask. You just need to program it, and if you don't know programming, learning is the only way.
Using tilesfromtexture would be a hell of a lot faster then loading each individual tile via editart. No I know how to make the 8bit tiles oscillate in editart from when I used to design levels before. It's just weird that when I copied over the tiles file(s) to my eduke folder. Nothing changed.
Guess I need to learn how to program now. It looks a bit like php but without the ; at the end of everything lol
#1482 Posted 23 May 2014 - 06:56 PM
Commando Nukem, on 23 May 2014 - 01:47 PM, said:
Right here, I want to project onto the screen the POV of another object. In this instance a pigcop with a palette of 200. I'm sure this will come off as a bit amusing to some of you, but i'm honestly stumped.

gamevar ptemp 0 2 gamevar ptemp2 0 2 // ('squadmate') Camera onevent EVENT_DISPLAYREST { getactor[THISACTOR].picnum ptemp ifvare ptemp PIGCOP getactor[THISACTOR].pal ptemp2 ifvare ptemp2 200 getactor[THISACTOR].x x getactor[THISACTOR].y y getactor[THISACTOR].z z getactor[THISACTOR].ang ang // getactor[THISACTOR].horiz horiz // getactor[THISACTOR].horizoff temp // addvarvar horiz temp updatesectorz x y z sect showviewunbiased x y z ang horiz sect 16 41 56 69 } endevent
Obviously, this is not working. Oh, It does project a view onto the screen, but it's behind the player.
I'm almost certain I need to call the pig stuff in an EVENT_LOADACTOR and then reference it into the EVENT_DISPLAYREST stuff. I was trying that before and it either wasn't showing up, or was just showing a view from the player's feet.
Note, I commented out a few lines that weren't working (for obvious reasons, they reference a camera setup for a player position.)
So, can someone point me in the right direction?
DISPLAYREST is always called from the player, so it will never be true.
What you want is this
gamevar temp 0 2 gamevar camera_exist -1 1 gamevar camera_x 0 1 gamevar camera_y 0 1 gamevar camera_z 0 1 gamevar camera_horiz 0 1 gamevar camera_sect 0 1 onevent EVENT_DISPLAYREST ifvarn camera_exist -1 // we shouldn't display if there's no existing camera actor showviewunbiased camera_x camera_y camera_z camera_ang camera_horiz camera_sect 16 41 56 69 endevent onevent EVENT_GAME getactor[THISACTOR].picnum temp ifvare temp PIGCOP { getactor[THISACTOR].pal temp ifvarvare camera_exist THISACTOR ifvarn temp 200 // if the pal is altered somehow we can remove it as the camera setvar camera_exist -1 else ifvare temp 200 { getactor[THISACTOR].x camera_x getactor[THISACTOR].y camera_y getactor[THISACTOR].z camera_z subvar camera_z 8192 // offset until you get to eye level getactor[THISACTOR].ang camera_ang getactor[THISACTOR].sectnum camera_sect setvar camera_horiz 100 setvarvar camera_exist THISACTOR } } endevent
#1483 Posted 24 May 2014 - 05:57 AM
Thank you for commenting it too. I'm honestly trying to find my way through and learn CON, as much as lack the natural talent for coding.

#1484 Posted 24 May 2014 - 08:25 AM
Hendricks266, on 22 May 2014 - 12:55 PM, said:
Animated gifs don't automatically become animations in ART. You have to define the tiles separately and set the ART animation value (from defs, the animtilerange command).
The CON files are a scripting language containing elements from C and assembly, so there is no simple solution to what you ask. You just need to program it, and if you don't know programming, learning is the only way.
Mapster error log below
Error on line 8bit.def:11: expecting symbol, got "0}" Error on line 8bit.def:13: expecting symbol, got "0}"
Def Code below
// Stripper00 (3504) tilefromtexture 3504 { file "CustomT/8bit/3504.png" xoffset -2 } tilefromtexture 3505 { file "CustomT/8bit/3505.png" xoffset -2 } tilefromtexture 3506 { file "CustomT/8bit/3506.png" xoffset -2 } tilefromtexture 3507 { file "CustomT/8bit/3507.png" xoffset -2 } tilefromtexture 3508 { file "CustomT/8bit/3508.png" xoffset -2 } <<-- Line 11 animtilerange 3404 3508 2 2 <<-- Line 13 tilefromtexture 3509 { file "CustomT/8bit/3509.png" xoffset 0} // For some reason if I don't define the X they don't appear in the tiles listing. tilefromtexture 3510 { file "CustomT/8bit/3510.png" xoffset -1 } tilefromtexture 3511 { file "CustomT/8bit/3511.gif" xoffset 0}
Tiles appear in mapster. But she doesn't move.
This post has been edited by 1337DirtAlliance: 24 May 2014 - 08:25 AM
#1485 Posted 24 May 2014 - 09:06 AM
1337DirtAlliance, on 24 May 2014 - 08:25 AM, said:
Error on line 8bit.def:11: expecting symbol, got "0}" Error on line 8bit.def:13: expecting symbol, got "0}"
Def Code below
// Stripper00 (3504) tilefromtexture 3504 { file "CustomT/8bit/3504.png" xoffset -2 } tilefromtexture 3505 { file "CustomT/8bit/3505.png" xoffset -2 } tilefromtexture 3506 { file "CustomT/8bit/3506.png" xoffset -2 } tilefromtexture 3507 { file "CustomT/8bit/3507.png" xoffset -2 } tilefromtexture 3508 { file "CustomT/8bit/3508.png" xoffset -2 } <<-- Line 11 animtilerange 3404 3508 2 2 <<-- Line 13 tilefromtexture 3509 { file "CustomT/8bit/3509.png" xoffset 0} // For some reason if I don't define the X they don't appear in the tiles listing. tilefromtexture 3510 { file "CustomT/8bit/3510.png" xoffset -1 } tilefromtexture 3511 { file "CustomT/8bit/3511.gif" xoffset 0}
Tiles appear in mapster. But she doesn't move.
In the second group, you need a space between the 0 and }'s.

This post has been edited by Commando Nukem: 24 May 2014 - 09:07 AM
#1486 Posted 24 May 2014 - 01:58 PM
<SOLVED> But there is still minor issue
Ended up just saying eat a bag of shit to the duke folder and deleted it. Backed up my content but did a clean install of everything and now it works. Still have animation issues not working tho with the tiles defined in the def. And the spacing issue didn't change anything
Also.. I don't think any of the Warambiance work period. Because I went to upload new ones as an addition. And of course they don't work... tried to see if the normal ones worked,.. nope.
This post has been edited by 1337DirtAlliance: 25 May 2014 - 02:29 PM