Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Simple plotscripting question

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Mon May 20, 2013 5:37 pm    Post subject: Simple plotscripting question Reply with quote

so I want our hero to be able to recieve a certain number of item (138) based off of the level they just gained, using the formula (level/4)+1
I understand i will need to use the
get hero level (me) command and the
get item (138, ((level/4)+1)) command
but I dont know what to put in place of "level" in the second command to make it refer to the previous value found by the first command
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon May 20, 2013 5:52 pm    Post subject: Reply with quote

Variables!

To declare a (local) variable, write "variable (level)" inside a script. The variable will only be visible inside that script, and the value is forgotten when it exits.

To assign a value to a variable, write "level := get hero level (me)"

Wow, I've just noticed that the Plotscripting Tutorial doesn't even cover variables. We really could do with a longer/more tutorials.

BTW, note that level/4 rounds down. e.g. 7/4 is 1.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
gagekilmer
Ninja... nuff said




Joined: 09 Jan 2013
Posts: 53

PostPosted: Mon May 20, 2013 6:04 pm    Post subject: Reply with quote

thanks TMC, is it possible to make things round up? thats how we calculated it when we decided upon a formula, its not a huge deal but is it possible?
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon May 20, 2013 7:26 pm    Post subject: Reply with quote

Yes, you just add a little to the numerator. If you want a/b to round up, then write (a + b/2)/b. So level/4 becomes (level+2)/4.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group