Author Topic: SAY [OFFSET] #-1  (Read 8918 times)

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
SAY [OFFSET] #-1
« on: October 08, 2009, 02:25:16 AM »
For some reason, this doesn't work (seems to enter the largest integer possible for the offset instead). Could've sworn it used to, or at least Nythrun seemed to think so (has it in her macros).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #1 on: October 08, 2009, 06:16:19 AM »
Is there any reason (except for expecting WeiDU to actually be consistent) why you can't WRITE_LONG OFFSET (0 - 1)?
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #2 on: October 08, 2009, 08:14:36 AM »
Yep, have run into the same thing few days earlier while testing my new library.

You can also use ~-1~.

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #3 on: October 13, 2009, 05:08:33 PM »
Is there any reason (except for expecting WeiDU to actually be consistent) why you can't WRITE_LONG OFFSET (0 - 1)?
No, I thought the SAY actually worked at one point though. And maybe I expected WeiDU to be consistent. What *was* I thinking?!

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #4 on: October 13, 2009, 06:18:56 PM »
Now for the non-jerk reply. The code behind SAY is the same between 185 and 211. The problem is that












http://upload.wikimedia.org/wikipedia/commons/e/ee/Beet5mov1bars1to5.ogg












standard integers in OCaml are 31 bit signed integers, rather than 32 bit signed. Apparently different versions of OCaml differ in how they hande negative numbers and bitwise operation. I've forced the 'save integer to string' code to always use 32 bit integers (which are available but well-hidden), which fixed the problem.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: SAY [OFFSET] #-1
« Reply #5 on: October 13, 2009, 08:35:04 PM »
*perfect* clip *)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #6 on: October 14, 2009, 06:21:43 AM »
Actually, Beethoven's 5th symphony isn't nearly ominous enough to introduce the idea of 31 bit integers, but I couldn't think of anything better.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: SAY [OFFSET] #-1
« Reply #7 on: October 14, 2009, 06:46:32 AM »
You could try movie soundtracks from "Jaws", "The Shining", or perhaps even "The Twilight Zone" :D

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #8 on: October 14, 2009, 11:25:43 AM »
Perhaps the Geto Boys' timeless classic "Still" (the theme played during the printer/fax machine baseball-bat-bashing in the movie "Office Space").

Offline temujin

  • Planewalker
  • *****
  • Posts: 78
Re: SAY [OFFSET] #-1
« Reply #9 on: October 14, 2009, 10:40:24 PM »
I think this nice little Bambi music would also be appropriate.

Offline Nythrun

  • Planewalker
  • *****
  • Posts: 89
  • Gender: Female
Re: SAY [OFFSET] #-1
« Reply #10 on: January 08, 2010, 02:41:29 AM »
Nythrun seemed to think so (has it in her macros).

I never. SAY is solely for adding new strings, and has been since the .tp2/.d grammar split :)

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #11 on: January 08, 2010, 04:26:05 PM »
Nythrun seemed to think so (has it in her macros).
I never. SAY is solely for adding new strings, and has been since the .tp2/.d grammar split
I dunno, maybe it was something Yovaneth added then. I think I was working with a version of this code which, no, does not seem to have that syntax in its original form.

Speaking of which, do we have a macro that does this yet (adds an animation entry to an area) maybe in the last batch added? If not, is it something we can macroise/functionise?

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #12 on: January 08, 2010, 04:33:25 PM »
Since I'm the usual lazy asshole I'm not going to code macros for handling ARE files, but if you code (and test) them up I have no problems with adding them to 214.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: SAY [OFFSET] #-1
« Reply #13 on: January 10, 2010, 11:40:48 AM »
Sorry, late to the party, but either Smoketest or devSin taught me back in the day

    WRITE_LONG INITIAL_MEETING (BNOT 0x0) // BLANKING SOUNDS

as a fancier looking code-guru-like way of doing it.

Offline Miloch

  • Barbarian
  • Planewalker
  • *****
  • Posts: 1032
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #14 on: January 10, 2010, 06:02:34 PM »
(BNOT 0x0)... fancier looking...
"Fancier looking"? Like the bigg said... pass the bong.

Why wouldn't you just use (0 - 1) or ~-1~ if you want to set them to -1, which it appears you want to do?

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #15 on: January 10, 2010, 07:04:58 PM »
BNOT 0 is a cool trick if you don't know 2-complement notation  :D
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #16 on: January 10, 2010, 07:51:39 PM »
yawn
« Last Edit: January 10, 2010, 07:58:12 PM by devSin »

temujin.

  • Guest
Re: SAY [OFFSET] #-1
« Reply #17 on: January 10, 2010, 08:36:50 PM »
Quote
« Last Edit: Today at 07:58:12 PM by devSin »

:D

<3 devSin

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: SAY [OFFSET] #-1
« Reply #18 on: January 10, 2010, 10:17:50 PM »
As a working musician, I know lots of notation, but don't get "complements"... (that is a pun, or feeble wordplay humor, for you ESL folks!)

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #19 on: January 11, 2010, 05:24:38 AM »
Quote
Speaking of which, do we have a macro that does this yet (adds an animation entry to an area) maybe in the last batch added? If not, is it something we can macroise/functionise?
Code: [Select]
// writing macro, can later be used for other ADD_STUFF functions
DEFINE_PATCH_MACRO wpt_wo BEGIN
  LPM ~wpt_lo_%ext%_%obj%~
  PHP_EACH $wpt_lo("%ext%""%obj%""nam") AS ind => res BEGIN
    PATCH_IF VARIABLE_IS_SET res BEGIN
      len=$wpt_lo("%ext%""%obj%""len""%ind%")
      off=$wpt_lo("%ext%""%obj%""off""%ind%")+offset
      PATCH_IF len=1 BEGIN WRITE_BYTE  off EVAL ~%res%~ END
      PATCH_IF len=2 BEGIN WRITE_SHORT off EVAL ~%res%~ END
      PATCH_IF len=4 BEGIN WRITE_LONG  off EVAL ~%res%~ END
      PATCH_IF (len!=1)&(len!=2)&(len!=4) BEGIN WRITE_ASCIIE off EVAL ~%%res%%~ (len) END
    END
  END
END


// loading offsets
DEFINE_PATCH_MACRO wpt_lo_are_anima BEGIN
  DEFINE_ARRAY wpt_lo_are_anima_nam BEGIN name position_X position_Y schedule bam_source flags position_Z loop END
  DEFINE_ARRAY wpt_lo_are_anima_off BEGIN 0x0  0x20       0x22       0x24     0x28       0x34  0x38       0x3e END
  DEFINE_ARRAY wpt_lo_are_anima_len BEGIN 32   2          2          4        8          4     2          1    END
END


// launcher itself
DEFINE_PATCH_FUNCTION add_area_animation
  INT_VAR
    flags=1+4
    schedule=`0
    loop=100
BEGIN
  LPM wapt_Q_ARE_InitVars    //launch variable initiation macro
  LPM wapt_Q_AREAdd_InitVars //launch variable initiation macro for adding new sections
  Q_New_Anima=1
  LPM wapt_Q_AREAdd_Process  //launch macro that adds new space for above listed entries
  offset=Q_NewOffset_Anima   // from where we'll do writing
  SPRINT ext are
  SPRINT obj anima
  LPM wpt_wo
END
Does it need more writable offsets? Nythrun's list, AG's list or IESDP.

Miloch, you go ahead and test it. I know you love testing :)
Though I see no reason it shouldn't work, the writing macro is from my personal lib and was working reliably.
Code: [Select]
COPY_EXISTING ar0500.are override
  LPF add_area_animation
    INT_VAR
 flags=7
 position_X=2400
 position_Y=1400
 position_Z=85
    STR_VAR
 name=ag_test_anima
 bam_source=fire_3
  END
BUT_ONLY

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #20 on: January 11, 2010, 12:03:36 PM »
BNOT 0 is a cool trick if you don't know 2-complement notation  :D
OK, I don't understand this. With TP2 syntax and a determinate data size, it's simple to express -N as BNOT N-1 (e.g., `0 is -1, or Miloch's version of fancy ~-1~ about as fancy as a cow's rear, or "all bits," which is what we really mean with a null strref).

I call bullshit that you actually had a point there. TP2 CODE OR IT DIDN'T HAPPENZ!

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #21 on: January 11, 2010, 12:46:02 PM »
2-complement means that "0 - x" is expressed as "(` x) + 1".
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #22 on: January 11, 2010, 03:40:52 PM »
Like I said, how is `(x-1) a "cool trick" over `1 + 1 at a fixed data size?

E.g., if I want to WRITE_SHORT -126, your implication was that two's-complement would give me something "cooler" than `125?
WHAT COULD BE COOLER THAN `125?

I expect some uber pwnage when you make a statement like "BNOT 0 is a cool trick if you don't know 2-complement notation."



I caught GeN1e stalking pamela123, checking out her profile. You want to ask her out, don't you, GeN1e?
You should. She goes down on the first date.
« Last Edit: January 11, 2010, 03:45:48 PM by devSin »

Offline GeN1e

  • Planewalker
  • *****
  • Posts: 267
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #23 on: January 11, 2010, 04:24:34 PM »
Quote
I caught GeN1e stalking pamela123, checking out her profile.
I thought you were ranking a mere member here, no? Or how can you be knowning if I was checking out a specific profile?

Besides, dev, don't you think you're taking it too far? We all are one big family and we all understand if you can't resist the urge to try and get rough with every underteen slut that comes to PPG, but surely ascribing your perverted carnal desires to me as a form of revenge for me robbing your grandma (hey, that was your suggestion, not mine!) of the photo of you and temujin making out is going beyond all norms assumed in any decent society.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: SAY [OFFSET] #-1
« Reply #24 on: January 11, 2010, 04:44:29 PM »
but surely ascribing your perverted carnal desires to me as a form of revenge for me robbing your grandma (hey, that was your suggestion, not mine!) of the photo of you and temujin making out is going beyond all norms assumed in any decent society.
Yeah, that's what I thought.

You been busted, boy! Got caught with your hands in the cookie jar.

But don't feel bad. pamela123's got space for lots of hands.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: