jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 Right, I've looked in my main and used my knowlege of C++ and LUA (all programing languages have simmeralities) and had a look around here and this is what i think i should put in Main to make a energy regening tile:```sub ontouch(Energy) If Int(GetPlayerSP(Energy)) < 100 then Energy = 100 End IfEnd Sub```or should it be:```sub Scriptedtile1(Energy) If Int(GetPlayerSP(Energy)) < 100 then Energy = 100 End IfEnd Sub```Can someone with knowlage of this check please. Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 4, 2009 Share Posted September 4, 2009 ```sub Scriptedtile1(Energy) 'You're basically adding a new sub here, which means it won't be scripted tile anymore. If Int(GetPlayerSP(Energy)) < 100 then 'The () are there so the script knows which player it should check Energy = 100 'Not a valid sadscripting command End IfEnd Sub```Should be```Sub Scriptedtile(Index, script) 'Existing sub for Scripted Tiles Select Case Script 'The scripted tile attribute calls the script like this: Call Scriptedtile(index, x) where x is the number used to determine which script it should call Case 1 'int this case, x = 1 If Int(GetPlayerSP(Index)) < 100 then Call SetPlayerSP(index, 100) 'Proper SS command for setting players SP End if End SelectEnd Sub``` Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 will this work in EE2.7 Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 4, 2009 Share Posted September 4, 2009 The one you posted wont, the one I posted should work.Still adding some comments to previous post btw. Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 Thx, the comments helped me understand what went wrong, the "Energy = 100" came from LUA Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 4, 2009 Share Posted September 4, 2009 Glad I could help. Also, If you need to know all of the commands sadscript uses, I recommend checking this: [http://www.touchofdeathforums.com/smf/index.php?topic=8502.0](http://www.touchofdeathforums.com/smf/index.php?topic=8502.0) Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 Thx, i'll lock this now so it doesn't desend into an orgy of random comments. Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 new problem, I've added the tile to part of one of my maps, i step on it, and then use 1 energy (measured in percent) and it instantly drops to 4%!!! this is a big problem as my game relies on energyEDIT:I think it shoul set energy to max energy rather than 100 energy as max energy gets higher as you level up Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 4, 2009 Share Posted September 4, 2009 Yeah, my mistake.```Call SetPlayerSP(index, 100)```should be```Call SetPlayerSP(index, GetPlayerMaxSP(Index))``` Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 Nope, still not working! Link to comment Share on other sites More sharing options...
Valon328 Posted September 4, 2009 Share Posted September 4, 2009 Do you want just a tile to regenerate sp? I think this might work, my scriptign knowledge is slim to none> Call SetPlayerSP(Index, GetPlayerSP(Index) + 10) Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 wouldn't work, it would just add 10 to avalible energy on every touch, you would need a loop to do it that way Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 4, 2009 Share Posted September 4, 2009 @jangofett287:> Nope, still not working!Strange.@[Šß:> 超人 Ã…Â hÃdÓw ñÃÂñjä ¤VÃ¥löñ¤ ã‚· link=topic=51389.msg539135#msg539135 date=1252096513]> Do you want just a tile to regenerate sp? I think this might work, my scriptign knowledge is slim to noneI think it's pretty obvious he wanted a tile to refill all of the energy. Besides, that script would require you to step on and of the tile repeatedly to regenerate sp.The following error or errors occurred while posting this message:Warning - while you were typing a new reply has been posted. You may wish to review your post.What he said Link to comment Share on other sites More sharing options...
jangofett287 Posted September 4, 2009 Author Share Posted September 4, 2009 I'm getting better at sadscript! :azn: Link to comment Share on other sites More sharing options...
Diskmaster Posted September 4, 2009 Share Posted September 4, 2009 @jangofett287:> wouldn't work, it would just add 10 to avalible energy on every touch, you would need a loop to do it that wayyea, no. not a loop, a timer, otherwise it would execute an infinate number of regens, even if it is full and you will probably cause some extremedy lag. also, u might want it to run a quick check to see if it is 9 or less sp full because it will grant you extra sp every time u step on it (just revealed a bug) so lets say you have 500 total sp and you have 499 current sp and you step on the tile, your total sp will become 509, and everytime after that, it will rise by 10!!! so, this script will make little noobs become epic amazing super sp noobs who don't ever need the SPEED stat again.Try adding If GetPlayerSp(index)>GePlayerTotalSp(index) -11 thenThat might just fix it :azn: and sry I rambled on… Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 I've got it!```SubScriptedTile(Index, script) SelectCaseScript Case 1 If Int(GetPlayerSP(Index)) < 100 Then Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) End If EndSelect EndSub ```should be:```SubScriptedTile(Index, Script) SelectCaseScript Case 1 If Int(GetPlayerSP(Index)) < GetPlayerMaxSP(Index) Then Call SetPlayerSP(Index, PlayerMaxSP(Index)) End If EndSelect EndSub ``` Link to comment Share on other sites More sharing options...
Patrick Posted September 5, 2009 Share Posted September 5, 2009 Is it SubScriptedTile? Not SubScriptedtile? Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 ok i missed a capital, but it is there in my actual main, the question is will this work correctly? Link to comment Share on other sites More sharing options...
Patrick Posted September 5, 2009 Share Posted September 5, 2009 Space between Case and 1.So:Case 1. Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 ENOUGH GRAMMAR PROBLEMS!!!!!!!all i want to know is will the second script in my post set my SP to my MaxSP when i step on the relevent tile? Link to comment Share on other sites More sharing options...
Eviltyphoon Posted September 5, 2009 Share Posted September 5, 2009 You forgot a whole load of spaces, other then that, I see nothing wrong Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 ```SubScriptedTile(Index, Script) SelectCaseScript Case 1 If Int(GetPlayerSP(Index)) < GetPlayerMaxSP(Index) Then Call SetPlayerSP(Index, PlayerMaxSP(Index)) End If EndSelect EndSub ```go on then, why are the spaces needed? Link to comment Share on other sites More sharing options...
balliztik1 Posted September 5, 2009 Share Posted September 5, 2009 Sub ScriptedTile(Index, script)Select Case Script Case 1 If GetPlayerSP(Index) < GetPlayerMaxSP(Index) Then Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) End If End Select End SubCopy that. Are you using IE? If so, code from syntax highlighting won't have spaces in it, which will end up breaking your main.txt.@jangofett287:> ```> SubScriptedTile(Index, Script) > SelectCaseScript > Case 1 > If Int(GetPlayerSP(Index)) < GetPlayerMaxSP(Index) Then > Call SetPlayerSP(Index, PlayerMaxSP(Index)) > End If > EndSelect > EndSub > ```> > go on then, why are the spaces needed?For the same reason that "carpet" and "car pet" are not the same thing. "SubScriptedTile" is not "Sub ScriptedTile" and "SelectCaseScript" is not "Select Case Script". Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 if you want the technical awnser: the space and return characters are string delimiters (or something like that)the reason most of the spaces were missing is i typed it out rather than copying, so i forgot a lot of spaces!right, time to test that script, here goes nothing! Link to comment Share on other sites More sharing options...
jangofett287 Posted September 5, 2009 Author Share Posted September 5, 2009 (oops, double post)Gaahh, it still does the same thing! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now