Jump to content

reading .CRE values and inserting them into a DLG


Recommended Posts

SetToken() makes only sense for static strings. For your use case SetTokenGlobal() is probably the better choice. It assigns the value of a variable to the token and frees you of the hassle of defining and assigning lots of custom strrefs.

This is an example script how to determine the STR value of a creature. It requires two script passes before the token is successfully set:

// Called by the second script pass to set the token
IF
  Global("D5STRSET","GLOBAL",1)
THEN
  RESPONSE #100
    SetGlobal("D5STRSET","GLOBAL",2)
    SetTokenGlobal("D5STRVALUE","GLOBAL","d5_cur_str")
    Continue()
END

// Called by the first script pass
IF
  Global("D5STRSET","GLOBAL",0)
  CheckStat(LastSummonerOf(Myself),1,STR)
THEN
  RESPONSE #100
    SetGlobal("D5STRVALUE","GLOBAL",1)
    Continue()
END

IF
  Global("D5STRSET","GLOBAL",0)
  CheckStat(LastSummonerOf(Myself),2,STR)
THEN
  RESPONSE #100
    SetGlobal("D5STRVALUE","GLOBAL",2)
    Continue()
END

// ... repeat for STR 3..25


// Finalize the first script pass
IF
  Global("D5STRSET","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("D5STRSET","GLOBAL",1)
    Continue()
END

Afterwards (when variable D5STRSET is set to 2) you can start the dialog with the token set to the right value.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...